Scheduling infrastructure for absolutely everyone.
refactor: apply biome formatting to packages/features (#27844)
Eunjae Lee98b6d63164d5
diff --git a/apps/web/modules/bookings/components/BookEventForm/BookEventForm.tsx b/apps/web/modules/bookings/components/BookEventForm/BookEventForm.tsxindex 69619b28c7a..7db2fa5dc22 100644--- a/apps/web/modules/bookings/components/BookEventForm/BookEventForm.tsx+++ b/apps/web/modules/bookings/components/BookEventForm/BookEventForm.tsx@@ -8,11 +8,7 @@ import { useIsPlatformBookerEmbed } from "@calcom/atoms/hooks/useIsPlatformBookeimport { useBookerStoreContext } from "@calcom/features/bookings/Booker/BookerStoreProvider";import type { BookerEvent } from "@calcom/features/bookings/types";import ServerTrans from "@calcom/lib/components/ServerTrans";-import {- APP_NAME,- WEBSITE_PRIVACY_POLICY_URL,- WEBSITE_TERMS_URL,-} from "@calcom/lib/constants";+import { APP_NAME, WEBSITE_PRIVACY_POLICY_URL, WEBSITE_TERMS_URL } from "@calcom/lib/constants";import { ErrorCode } from "@calcom/lib/errorCodes";import { useLocale } from "@calcom/lib/hooks/useLocale";import type { TimeFormat } from "@calcom/lib/timeFormat";@@ -24,10 +20,7 @@ import { Form } from "@calcom/ui/components/form";import { formatEventFromTime } from "@calcom/features/bookings/Booker/utils/dates";import { useBookerTime } from "@calcom/features/bookings/Booker/hooks/useBookerTime";import type { UseBookingFormReturnType } from "@calcom/features/bookings/Booker/hooks/useBookingForm";-import type {- IUseBookingErrors,- IUseBookingLoadingStates,-} from "../../hooks/useBookings";+import type { IUseBookingErrors, IUseBookingLoadingStates } from "../../hooks/useBookings";import { BookingFields } from "./BookingFields";import { FormSkeleton } from "./Skeleton";@@ -75,10 +68,7 @@ export const BookEventForm = ({eventQuery: {isError: boolean;isPending: boolean;- data?: Pick<- BookerEvent,- "price" | "currency" | "metadata" | "bookingFields" | "locations"- > | null;+ data?: Pick<BookerEvent, "price" | "currency" | "metadata" | "bookingFields" | "locations"> | null;};}) => {const eventType = eventQuery.data;@@ -86,9 +76,7 @@ export const BookEventForm = ({const bookingData = useBookerStoreContext((state) => state.bookingData);const rescheduleUid = useBookerStoreContext((state) => state.rescheduleUid);const username = useBookerStoreContext((state) => state.username);- const isInstantMeeting = useBookerStoreContext(- (state) => state.isInstantMeeting- );+ const isInstantMeeting = useBookerStoreContext((state) => state.isInstantMeeting);const isPlatformBookerEmbed = useIsPlatformBookerEmbed();const { timeFormat, timezone } = useBookerTime();@@ -98,11 +86,7 @@ export const BookEventForm = ({const isPaidEvent = useMemo(() => {if (!eventType?.price) return false;const paymentAppData = getPaymentAppData(eventType);- return (- eventType?.price > 0 &&- !Number.isNaN(paymentAppData.price) &&- paymentAppData.price > 0- );+ return eventType?.price > 0 && !Number.isNaN(paymentAppData.price) && paymentAppData.price > 0;}, [eventType]);const paymentCurrency = useMemo(() => {@@ -110,8 +94,7 @@ export const BookEventForm = ({return getPaymentAppData(eventType)?.currency || "USD";}, [eventType]);- if (eventQuery.isError)- return <Alert severity="warning" message={t("error_booking_event")} />;+ if (eventQuery.isError) return <Alert severity="warning" message={t("error_booking_event")} />;if (eventQuery.isPending || !eventQuery.data) return <FormSkeleton />;if (!timeslot)return (@@ -144,8 +127,7 @@ export const BookEventForm = ({}}form={bookingForm}handleSubmit={onSubmit}- noValidate- >+ noValidate><BookingFieldsisDynamicGroupBooking={!!(username && username.indexOf("+") > -1)}fields={eventType.bookingFields}@@ -187,8 +169,7 @@ export const BookEventForm = ({key="please-select-a-new-time-button"type="button"className="underline"- onClick={onCancel}- >+ onClick={onCancel}>Please select a new time</button>,]}@@ -209,16 +190,14 @@ export const BookEventForm = ({className="text-emphasis hover:underline"key="terms"href={`${WEBSITE_TERMS_URL}`}- target="_blank"- >+ target="_blank">Terms</Link>,<LinkclassName="text-emphasis hover:underline"key="privacy"href={`${WEBSITE_PRIVACY_POLICY_URL}`}- target="_blank"- >+ target="_blank">Privacy Policy.</Link>,]}@@ -233,8 +212,7 @@ export const BookEventForm = ({className="text-emphasis hover:underline"key="terms"href={`${WEBSITE_TERMS_URL}`}- target="_blank"- >+ target="_blank">{t("terms")}</Link>{" "}{t("and")}{" "}@@ -242,8 +220,7 @@ export const BookEventForm = ({className="text-emphasis hover:underline"key="privacy"href={`${WEBSITE_PRIVACY_POLICY_URL}`}- target="_blank"- >+ target="_blank">{t("privacy_policy")}</Link>.@@ -251,11 +228,7 @@ export const BookEventForm = ({)}<div className="flex justify-end mt-auto space-x-2 modalsticky rtl:space-x-reverse">{isInstantMeeting ? (- <Button- type="submit"- color="primary"- loading={loadingStates.creatingInstantBooking}- >+ <Button type="submit" color="primary" loading={loadingStates.creatingInstantBooking}>{isPaidEvent ? t("pay_and_book") : t("confirm")}</Button>) : (@@ -266,8 +239,7 @@ export const BookEventForm = ({type="button"onClick={onCancel}data-testid="back"- className={classNames?.backButton}- >+ className={classNames?.backButton}>{t("back")}</Button>)}@@ -276,9 +248,7 @@ export const BookEventForm = ({type="submit"color="primary"disabled={- (!!shouldRenderCaptcha && !watchedCfToken) ||- isTimeslotUnavailable ||- confirmButtonDisabled+ (!!shouldRenderCaptcha && !watchedCfToken) || isTimeslotUnavailable || confirmButtonDisabled}loading={loadingStates.creatingBooking ||@@ -287,11 +257,8 @@ export const BookEventForm = ({}className={classNames?.confirmButton}data-testid={- rescheduleUid && bookingData- ? "confirm-reschedule-button"- : "confirm-book-button"- }- >+ rescheduleUid && bookingData ? "confirm-reschedule-button" : "confirm-book-button"+ }>{rescheduleUid && bookingData? t("reschedule"): renderConfirmNotVerifyEmailButtonCond@@ -352,9 +319,7 @@ const getError = ({}const messageKey =- error.message === ErrorCode.BookerLimitExceeded- ? "booker_upcoming_limit_reached"- : error.message;+ error.message === ErrorCode.BookerLimitExceeded ? "booker_upcoming_limit_reached" : error.message;return error?.message ? (<>@@ -362,9 +327,7 @@ const getError = ({{error.data?.traceId && (<div className="mt-2 text-xs text-subtle"><span className="font-medium">{t("trace_reference_id")}:</span>- <code className="ml-1 font-mono break-all select-all">- {error.data.traceId}- </code>+ <code className="ml-1 font-mono break-all select-all">{error.data.traceId}</code></div>)}</>diff --git a/packages/features/CalendarEventBuilder.ts b/packages/features/CalendarEventBuilder.tsindex cdf82699264..41aba2b7764 100644--- a/packages/features/CalendarEventBuilder.ts+++ b/packages/features/CalendarEventBuilder.ts@@ -86,22 +86,22 @@ export class CalendarEventBuilder {if (!eventType) throw new Error(`Booking ${uid} is missing eventType — it may have been deleted.`);const builder = new CalendarEventBuilder();- const {- description,- attendees,- references,- title,- startTime,- endTime,- location,- responses,- customInputs,- iCalUID,- iCalSequence,- oneTimePassword,- seatsReferences,- assignmentReason,- } = booking;+ const {+ description,+ attendees,+ references,+ title,+ startTime,+ endTime,+ location,+ responses,+ customInputs,+ iCalUID,+ iCalSequence,+ oneTimePassword,+ seatsReferences,+ assignmentReason,+ } = booking;const {conferenceCredentialId,@@ -187,18 +187,18 @@ export class CalendarEventBuilder {platformCancelUrl,platformBookingUrl,})- .withRecurring(recurring)- .withUid(uid)- .withOneTimePassword(oneTimePassword)- .withOrganization(organizationId)- .withAssignmentReason(- assignmentReason?.[0]?.reasonEnum- ? {- category: getAssignmentReasonCategory(assignmentReason[0].reasonEnum),- details: assignmentReason[0].reasonString ?? null,- }- : null- );+ .withRecurring(recurring)+ .withUid(uid)+ .withOneTimePassword(oneTimePassword)+ .withOrganization(organizationId)+ .withAssignmentReason(+ assignmentReason?.[0]?.reasonEnum+ ? {+ category: getAssignmentReasonCategory(assignmentReason[0].reasonEnum),+ details: assignmentReason[0].reasonString ?? null,+ }+ : null+ );// Seatsif (seatsReferences?.length && bookingResponses) {@@ -533,23 +533,23 @@ export class CalendarEventBuilder {return this;}- withHashedLink(hashedLink?: string | null) {- this.event = {- ...this.event,- hashedLink,- };- return this;- }+ withHashedLink(hashedLink?: string | null) {+ this.event = {+ ...this.event,+ hashedLink,+ };+ return this;+ }- withAssignmentReason(assignmentReason?: { category: string; details?: string | null } | null) {- this.event = {- ...this.event,- assignmentReason,- };- return this;- }+ withAssignmentReason(assignmentReason?: { category: string; details?: string | null } | null) {+ this.event = {+ ...this.event,+ assignmentReason,+ };+ return this;+ }- build(): CalendarEvent | null {+ build(): CalendarEvent | null {// Validate required fieldsif (!this.event.startTime ||diff --git a/packages/features/assignment-reason/repositories/AssignmentReasonRepository.ts b/packages/features/assignment-reason/repositories/AssignmentReasonRepository.tsindex b6b6c4cd4ae..96747405669 100644--- a/packages/features/assignment-reason/repositories/AssignmentReasonRepository.ts+++ b/packages/features/assignment-reason/repositories/AssignmentReasonRepository.ts@@ -64,4 +64,3 @@ export class AssignmentReasonRepository {});}}-diff --git a/packages/features/attributes/di/AttributeService.container.ts b/packages/features/attributes/di/AttributeService.container.tsindex 09bee93f568..32ba316001f 100644--- a/packages/features/attributes/di/AttributeService.container.ts+++ b/packages/features/attributes/di/AttributeService.container.ts@@ -1,9 +1,6 @@import { createContainer } from "@calcom/features/di/di";-import {- type AttributeService,- moduleLoader as attributeServiceModule,-} from "./AttributeService.module";+import { type AttributeService, moduleLoader as attributeServiceModule } from "./AttributeService.module";const attributeServiceContainer = createContainer();diff --git a/packages/features/attributes/di/AttributeService.module.ts b/packages/features/attributes/di/AttributeService.module.tsindex 81a38cf1826..43ed9e5fd11 100644--- a/packages/features/attributes/di/AttributeService.module.ts+++ b/packages/features/attributes/di/AttributeService.module.ts@@ -1,8 +1,4 @@-import {- bindModuleToClassOnToken,- createModule,- type ModuleLoader,-} from "@calcom/features/di/di";+import { bindModuleToClassOnToken, createModule, type ModuleLoader } from "@calcom/features/di/di";import { AttributeService } from "../services/AttributeService";import { moduleLoader as attributeToUserRepositoryModuleLoader } from "./AttributeToUserRepository.module";diff --git a/packages/features/attributes/lib/getAttributes.test.ts b/packages/features/attributes/lib/getAttributes.test.tsindex 4e91b6fe2a5..2cfe6d53229 100644--- a/packages/features/attributes/lib/getAttributes.test.ts+++ b/packages/features/attributes/lib/getAttributes.test.ts@@ -868,18 +868,22 @@ describe("getAttributes", () => {attributeOptionId: "level-senior",});- const { attributesOfTheOrg, attributesAssignedToTeamMembersWithOptions } = await getAttributesAssignmentData({- teamId: team.id,- orgId,- attributeIds: ["attr1", "attr2"],- });+ const { attributesOfTheOrg, attributesAssignedToTeamMembersWithOptions } =+ await getAttributesAssignmentData({+ teamId: team.id,+ orgId,+ attributeIds: ["attr1", "attr2"],+ });expect(attributesOfTheOrg).toHaveLength(2);expect(attributesOfTheOrg.map((a) => a.id).sort()).toEqual(["attr1", "attr2"]);expect(attributesAssignedToTeamMembersWithOptions).toHaveLength(1);expect(attributesAssignedToTeamMembersWithOptions[0].userId).toBe(user.id);- expect(Object.keys(attributesAssignedToTeamMembersWithOptions[0].attributes)).toEqual(["attr1", "attr2"]);+ expect(Object.keys(attributesAssignedToTeamMembersWithOptions[0].attributes)).toEqual([+ "attr1",+ "attr2",+ ]);expect(attributesAssignedToTeamMembersWithOptions[0].attributes.attr1).toBeDefined();expect(attributesAssignedToTeamMembersWithOptions[0].attributes.attr2).toBeDefined();expect(attributesAssignedToTeamMembersWithOptions[0].attributes.attr3).toBeUndefined();@@ -898,7 +902,9 @@ describe("getAttributes", () => {name: "Department",slug: "department",type: AttributeType.SINGLE_SELECT,- options: [{ id: "dept-eng", value: "Engineering", slug: "engineering", isGroup: false, contains: [] }],+ options: [+ { id: "dept-eng", value: "Engineering", slug: "engineering", isGroup: false, contains: [] },+ ],});await createMockAttribute({@@ -942,7 +948,9 @@ describe("getAttributes", () => {name: "Department",slug: "department",type: AttributeType.SINGLE_SELECT,- options: [{ id: "dept-eng", value: "Engineering", slug: "engineering", isGroup: false, contains: [] }],+ options: [+ { id: "dept-eng", value: "Engineering", slug: "engineering", isGroup: false, contains: [] },+ ],});await createMockAttributeAssignment({@@ -973,7 +981,9 @@ describe("getAttributes", () => {name: "Department",slug: "department",type: AttributeType.SINGLE_SELECT,- options: [{ id: "dept-eng", value: "Engineering", slug: "engineering", isGroup: false, contains: [] }],+ options: [+ { id: "dept-eng", value: "Engineering", slug: "engineering", isGroup: false, contains: [] },+ ],});await createMockAttributeAssignment({@@ -1006,10 +1016,22 @@ describe("getAttributes", () => {data: { name: "User 2", email: "[email protected]" },});const orgMembership2 = await prismock.membership.create({- data: { role: MembershipRole.MEMBER, disableImpersonation: false, accepted: true, teamId: orgId, userId: user2.id },+ data: {+ role: MembershipRole.MEMBER,+ disableImpersonation: false,+ accepted: true,+ teamId: orgId,+ userId: user2.id,+ },});await prismock.membership.create({- data: { role: MembershipRole.MEMBER, disableImpersonation: false, accepted: true, teamId: team.id, userId: user2.id },+ data: {+ role: MembershipRole.MEMBER,+ disableImpersonation: false,+ accepted: true,+ teamId: team.id,+ userId: user2.id,+ },});// User 3 has no attribute assignments at all@@ -1017,10 +1039,22 @@ describe("getAttributes", () => {data: { name: "User 3", email: "[email protected]" },});await prismock.membership.create({- data: { role: MembershipRole.MEMBER, disableImpersonation: false, accepted: true, teamId: orgId, userId: user3.id },+ data: {+ role: MembershipRole.MEMBER,+ disableImpersonation: false,+ accepted: true,+ teamId: orgId,+ userId: user3.id,+ },});await prismock.membership.create({- data: { role: MembershipRole.MEMBER, disableImpersonation: false, accepted: true, teamId: team.id, userId: user3.id },+ data: {+ role: MembershipRole.MEMBER,+ disableImpersonation: false,+ accepted: true,+ teamId: team.id,+ userId: user3.id,+ },});await createMockAttribute({diff --git a/packages/features/attributes/lib/getAttributes.ts b/packages/features/attributes/lib/getAttributes.tsindex b393022c782..366b7691421 100644--- a/packages/features/attributes/lib/getAttributes.ts+++ b/packages/features/attributes/lib/getAttributes.ts@@ -1,9 +1,6 @@// TODO: Queries in this file are not optimized. Need to optimize them.import type { Attribute } from "@calcom/app-store/routing-forms/types/types";-import type {- AttributeId,- AttributeOptionValueWithType,-} from "@calcom/app-store/routing-forms/types/types";+import type { AttributeId, AttributeOptionValueWithType } from "@calcom/app-store/routing-forms/types/types";import { PrismaAttributeRepository } from "@calcom/features/attributes/repositories/PrismaAttributeRepository";import { PrismaAttributeToUserRepository } from "@calcom/features/attributes/repositories/PrismaAttributeToUserRepository";import logger from "@calcom/lib/logger";@@ -88,13 +85,7 @@ type FullAttribute = {}[];};-async function _findMembershipsForBothOrgAndTeam({- orgId,- teamId,-}: {- orgId: number;- teamId: number;-}) {+async function _findMembershipsForBothOrgAndTeam({ orgId, teamId }: { orgId: number; teamId: number }) {const memberships = await prisma.membership.findMany({where: {teamId: {@@ -186,10 +177,7 @@ function _prepareAssignmentData({newAttributeOptionValue,];} else if (currentAttributeOptionValue) {- attributes[attribute.id].attributeOption = [- currentAttributeOptionValue,- newAttributeOptionValue,- ];+ attributes[attribute.id].attributeOption = [currentAttributeOptionValue, newAttributeOptionValue];} else {// Set the first valueattributes[attribute.id] = {@@ -231,9 +219,7 @@ function _prepareAssignmentData({console.error(`Enriching "contains" for attribute ${attribute.name- }: Option with id ${optionId} not found. Looked up in ${JSON.stringify(- allOptions- )}`+ }: Option with id ${optionId} not found. Looked up in ${JSON.stringify(allOptions)}`);return null;}@@ -243,9 +229,7 @@ function _prepareAssignmentData({slug: option.slug,};})- .filter(- (option): option is NonNullable<typeof option> => option !== null- );+ .filter((option): option is NonNullable<typeof option> => option !== null);}}@@ -255,10 +239,7 @@ function _prepareAssignmentData({*/function _buildAttributeLookupMaps(attributesOfTheOrg: FullAttribute[]) {const optionIdToAttribute = new Map<AttributeOptionId, FullAttribute>();- const optionIdToOption = new Map<- AttributeOptionId,- FullAttribute["options"][number]- >();+ const optionIdToOption = new Map<AttributeOptionId, FullAttribute["options"][number]>();const attributeIdToOptions = new Map<string, FullAttribute["options"]>();for (const attribute of attributesOfTheOrg) {@@ -294,31 +275,19 @@ function _getAttributeOptionFromId({return lookupMaps.optionIdToOption.get(attributeOptionId);}-async function _getOrgMembershipToUserIdForTeam({- orgId,- teamId,-}: {- orgId: number;- teamId: number;-}) {- const { orgMemberships, teamMemberships } =- await _findMembershipsForBothOrgAndTeam({- orgId,- teamId,- });+async function _getOrgMembershipToUserIdForTeam({ orgId, teamId }: { orgId: number; teamId: number }) {+ const { orgMemberships, teamMemberships } = await _findMembershipsForBothOrgAndTeam({+ orgId,+ teamId,+ });// Using map for performance lookup as it matters in the below loop working with 1000s of records- const orgMembershipsByUserId = new Map(- orgMemberships.map((m) => [m.userId, m])- );+ const orgMembershipsByUserId = new Map(orgMemberships.map((m) => [m.userId, m]));/*** Holds the records of orgMembershipId to userId for the sub-team's members only.*/- const orgMembershipToUserIdForTeamMembers = new Map<- OrgMembershipId,- UserId- >();+ const orgMembershipToUserIdForTeamMembers = new Map<OrgMembershipId, UserId>();/*** For an organization with 3000 users and 10 teams, with every team having around 300 members, the total memberships we get for a team are 3000+300 = 3300@@ -332,10 +301,7 @@ async function _getOrgMembershipToUserIdForTeam({// );return;}- orgMembershipToUserIdForTeamMembers.set(- orgMembership.id,- orgMembership.userId- );+ orgMembershipToUserIdForTeamMembers.set(orgMembership.id, orgMembership.userId);});return orgMembershipToUserIdForTeamMembers;@@ -354,23 +320,19 @@ async function _queryAllData({const attributeRepo = new PrismaAttributeRepository(prisma);const attributeToUserRepo = new PrismaAttributeToUserRepository(prisma);- const [orgMembershipToUserIdForTeamMembers, attributesOfTheOrg] =- await Promise.all([- _getOrgMembershipToUserIdForTeam({ orgId, teamId }),- attributeRepo.findManyByOrgId({ orgId, attributeIds }),- ]);+ const [orgMembershipToUserIdForTeamMembers, attributesOfTheOrg] = await Promise.all([+ _getOrgMembershipToUserIdForTeam({ orgId, teamId }),+ attributeRepo.findManyByOrgId({ orgId, attributeIds }),+ ]);- const orgMembershipIds = Array.from(- orgMembershipToUserIdForTeamMembers.keys()- );+ const orgMembershipIds = Array.from(orgMembershipToUserIdForTeamMembers.keys());// Get the attributes assigned to the members of the team// If attributeIds is provided, only fetch assignments for those specific attributes- const attributesToUsersForTeam =- await attributeToUserRepo.findManyByOrgMembershipIds({- orgMembershipIds,- attributeIds,- });+ const attributesToUsersForTeam = await attributeToUserRepo.findManyByOrgMembershipIds({+ orgMembershipIds,+ attributeIds,+ });return {attributesOfTheOrg,@@ -379,13 +341,7 @@ async function _queryAllData({};}-async function getAttributesAssignedToMembersOfTeam({- teamId,- userId,-}: {- teamId: number;- userId?: number;-}) {+async function getAttributesAssignedToMembersOfTeam({ teamId, userId }: { teamId: number; userId?: number }) {const log = logger.getSubLogger({prefix: ["getAttributeToUserWithMembershipAndAttributes"],});@@ -455,9 +411,7 @@ function _buildAssignmentsForTeam({const orgMembershipId = attributeToUser.memberId;const userId = orgMembershipToUserIdForTeamMembers.get(orgMembershipId);if (!userId) {- console.error(- `No org membership found for membership id ${orgMembershipId}`- );+ console.error(`No org membership found for membership id ${orgMembershipId}`);return null;}const attribute = _getAttributeFromAttributeOption({@@ -484,10 +438,7 @@ function _buildAssignmentsForTeam({attributeOption,};})- .filter(- (assignment): assignment is NonNullable<typeof assignment> =>- assignment !== null- );+ .filter((assignment): assignment is NonNullable<typeof assignment> => assignment !== null);}export async function getAttributesAssignmentData({@@ -501,15 +452,12 @@ export async function getAttributesAssignmentData({* This significantly improves performance when only a few attributes are needed. */attributeIds?: string[];}) {- const {- attributesOfTheOrg,- attributesToUsersForTeam,- orgMembershipToUserIdForTeamMembers,- } = await _queryAllData({- orgId,- teamId,- attributeIds,- });+ const { attributesOfTheOrg, attributesToUsersForTeam, orgMembershipToUserIdForTeamMembers } =+ await _queryAllData({+ orgId,+ teamId,+ attributeIds,+ });const lookupMaps = _buildAttributeLookupMaps(attributesOfTheOrg);@@ -550,12 +498,6 @@ export async function getAttributesForTeam({ teamId }: { teamId: number }) {return attributes satisfies Attribute[];}-export async function getUsersAttributes({- userId,- teamId,-}: {- userId: number;- teamId: number;-}) {+export async function getUsersAttributes({ userId, teamId }: { userId: number; teamId: number }) {return await getAttributesAssignedToMembersOfTeam({ teamId, userId });}diff --git a/packages/features/attributes/repositories/PrismaAttributeRepository.ts b/packages/features/attributes/repositories/PrismaAttributeRepository.tsindex 4e14c8b593c..36fdefa2f95 100644--- a/packages/features/attributes/repositories/PrismaAttributeRepository.ts+++ b/packages/features/attributes/repositories/PrismaAttributeRepository.ts@@ -103,13 +103,7 @@ export class PrismaAttributeRepository {});}- findManyByIdsAndOrgIdWithOptions({- attributeIds,- orgId,- }: {- attributeIds: string[];- orgId: number;- }) {+ findManyByIdsAndOrgIdWithOptions({ attributeIds, orgId }: { attributeIds: string[]; orgId: number }) {return this.prismaClient.attribute.findMany({where: {teamId: orgId,diff --git a/packages/features/attributes/services/AttributeService.ts b/packages/features/attributes/services/AttributeService.tsindex 5f06c26dd18..611edb4b297 100644--- a/packages/features/attributes/services/AttributeService.ts+++ b/packages/features/attributes/services/AttributeService.ts@@ -30,10 +30,11 @@ export class AttributeService {userId: number;orgId: number;}): Promise<Record<string, UserAttribute>> {- const attributeOptionsAssignedToUser =- await this.deps.attributeToUserRepository.findManyIncludeAttribute({+ const attributeOptionsAssignedToUser = await this.deps.attributeToUserRepository.findManyIncludeAttribute(+ {member: { userId, teamId: orgId },- });+ }+ );const userAttributes: Record<string, UserAttribute> = {};diff --git a/packages/features/attributes/services/attributeService.test.ts b/packages/features/attributes/services/attributeService.test.tsindex a0fb5fa7408..1dbf3252ddd 100644--- a/packages/features/attributes/services/attributeService.test.ts+++ b/packages/features/attributes/services/attributeService.test.ts@@ -17,16 +17,13 @@ describe("AttributeService", () => {};service = new AttributeService({- attributeToUserRepository:- mockAttributeToUserRepository as unknown as PrismaAttributeToUserRepository,+ attributeToUserRepository: mockAttributeToUserRepository as unknown as PrismaAttributeToUserRepository,});});describe("getUsersAttributesByOrgMembershipId", () => {it("should return empty object when user has no attributes", async () => {- mockAttributeToUserRepository.findManyIncludeAttribute.mockResolvedValue(- []- );+ mockAttributeToUserRepository.findManyIncludeAttribute.mockResolvedValue([]);const result = await service.getUsersAttributesByOrgMembershipId({userId: 1,@@ -34,9 +31,7 @@ describe("AttributeService", () => {});expect(result).toEqual({});- expect(- mockAttributeToUserRepository.findManyIncludeAttribute- ).toHaveBeenCalledWith({+ expect(mockAttributeToUserRepository.findManyIncludeAttribute).toHaveBeenCalledWith({member: { userId: 1, teamId: 100 },});});diff --git a/packages/features/auth/__mocks__/getServerSession.mocks.ts b/packages/features/auth/__mocks__/getServerSession.mocks.tsindex 754cbeb88f5..667b2eed3a1 100644--- a/packages/features/auth/__mocks__/getServerSession.mocks.ts+++ b/packages/features/auth/__mocks__/getServerSession.mocks.ts@@ -77,7 +77,9 @@ function createDeploymentRepositoryMock(): {}function createUserRepositoryMock(): {- UserRepository: new (_prisma: PrismaClient) => {+ UserRepository: new (+ _prisma: PrismaClient+ ) => {enrichUserWithTheProfile: (params: { user: User }) => Promise<User & { profile: null }>;};} {diff --git a/packages/features/auth/lib/getLocaleFromRequest.ts b/packages/features/auth/lib/getLocaleFromRequest.tsindex 29ae8a0df31..957ddb29cee 100644--- a/packages/features/auth/lib/getLocaleFromRequest.ts+++ b/packages/features/auth/lib/getLocaleFromRequest.ts@@ -1,4 +1,3 @@-import parser from "accept-language-parser";import type { GetServerSidePropsContext, NextApiRequest } from "next";diff --git a/packages/features/auth/lib/getServerSession.test.ts b/packages/features/auth/lib/getServerSession.test.tsindex 8bc261a45bb..74645e2ad80 100644--- a/packages/features/auth/lib/getServerSession.test.ts+++ b/packages/features/auth/lib/getServerSession.test.ts@@ -64,17 +64,14 @@ describe("getServerSession", () => {});describe("User ID Validation", () => {- it.each(["", "invalid", "0", "-1"])(- "returns null when token.sub is invalid (%s)",- async (sub) => {- setupGetTokenMock(createMockToken({ sub }));+ it.each(["", "invalid", "0", "-1"])("returns null when token.sub is invalid (%s)", async (sub) => {+ setupGetTokenMock(createMockToken({ sub }));- const result = await getServerSession({ req: createMockRequest() });+ const result = await getServerSession({ req: createMockRequest() });- expect(result).toBeNull();- expect(prismaMock.user.findUnique).not.toHaveBeenCalled();- }- );+ expect(result).toBeNull();+ expect(prismaMock.user.findUnique).not.toHaveBeenCalled();+ });});describe("User Lookup", () => {diff --git a/packages/features/auth/lib/next-auth-options.test.ts b/packages/features/auth/lib/next-auth-options.test.tsindex 17fd6c86c3f..38706d4145a 100644--- a/packages/features/auth/lib/next-auth-options.test.ts+++ b/packages/features/auth/lib/next-auth-options.test.ts@@ -23,9 +23,11 @@ const mockFindByEmailAndIncludeProfilesAndPassword = vi.fn();vi.mock("@calcom/features/users/repositories/UserRepository", () => {return {- UserRepository: vi.fn().mockImplementation(function() { return {- findByEmailAndIncludeProfilesAndPassword: mockFindByEmailAndIncludeProfilesAndPassword,- }; }),+ UserRepository: vi.fn().mockImplementation(function () {+ return {+ findByEmailAndIncludeProfilesAndPassword: mockFindByEmailAndIncludeProfilesAndPassword,+ };+ }),};});diff --git a/packages/features/auth/lib/next-auth-options.ts b/packages/features/auth/lib/next-auth-options.tsindex 731a3ca04aa..cd830fc7dc0 100644--- a/packages/features/auth/lib/next-auth-options.ts+++ b/packages/features/auth/lib/next-auth-options.ts@@ -640,14 +640,14 @@ export const getOptions = ({org:profileOrg && !profileOrg.isPlatform? {- id: profileOrg.id,- name: profileOrg.name,- slug: profileOrg.slug ?? profileOrg.requestedSlug ?? "",- logoUrl: profileOrg.logoUrl,- fullDomain: getOrgFullOrigin(profileOrg.slug ?? profileOrg.requestedSlug ?? ""),- domainSuffix: subdomainSuffix(),- role: orgRole as MembershipRole, // It can't be undefined if we have a profileOrg- }+ id: profileOrg.id,+ name: profileOrg.name,+ slug: profileOrg.slug ?? profileOrg.requestedSlug ?? "",+ logoUrl: profileOrg.logoUrl,+ fullDomain: getOrgFullOrigin(profileOrg.slug ?? profileOrg.requestedSlug ?? ""),+ domainSuffix: subdomainSuffix(),+ role: orgRole as MembershipRole, // It can't be undefined if we have a profileOrg+ }: null,} as JWT;};@@ -881,7 +881,10 @@ export const getOptions = ({}if (!user.name) {- log.warn("callbacks:signIn - user name is missing", { emailDomain: user.email.split("@")[1], provider: account?.provider });+ log.warn("callbacks:signIn - user name is missing", {+ emailDomain: user.email.split("@")[1],+ provider: account?.provider,+ });return false;}if (account?.provider) {@@ -1024,7 +1027,11 @@ export const getOptions = ({// Verify SAML IdP is authoritative before auto-mergeif (idP === IdentityProvider.SAML) {const samlTenant = getSamlTenant();- const validation = await validateSamlAccountConversion(samlTenant, user.email, "SelfHosted→SAML");+ const validation = await validateSamlAccountConversion(+ samlTenant,+ user.email,+ "SelfHosted→SAML"+ );if (!validation.allowed) {return validation.errorUrl;}@@ -1109,12 +1116,8 @@ export const getOptions = ({} else {return true;}- } else if (- existingUserWithEmail.identityProvider === IdentityProvider.CAL- ) {- log.error(- `Userid ${user.id} already exists with CAL identity provider`- );+ } else if (existingUserWithEmail.identityProvider === IdentityProvider.CAL) {+ log.error(`Userid ${user.id} already exists with CAL identity provider`);return `/auth/error?error=wrong-provider&provider=${existingUserWithEmail.identityProvider}`;} else if (existingUserWithEmail.identityProvider === IdentityProvider.GOOGLE &&@@ -1143,17 +1146,14 @@ export const getOptions = ({return true;}}- log.error(- `Userid ${user.id} trying to login with the wrong provider`,- {- userId: user.id,- account: {- providerAccountId: account?.providerAccountId,- type: account?.type,- provider: account?.provider,- },- }- );+ log.error(`Userid ${user.id} trying to login with the wrong provider`, {+ userId: user.id,+ account: {+ providerAccountId: account?.providerAccountId,+ type: account?.type,+ provider: account?.provider,+ },+ });return `/auth/error?error=wrong-provider&provider=${existingUserWithEmail.identityProvider}`;}diff --git a/packages/features/auth/lib/samlAccountLinking.ts b/packages/features/auth/lib/samlAccountLinking.tsindex 0e2a339e8a3..de618e5337d 100644--- a/packages/features/auth/lib/samlAccountLinking.ts+++ b/packages/features/auth/lib/samlAccountLinking.ts@@ -65,9 +65,7 @@ export class SamlAccountLinkingService {}}-export type AccountConversionValidationResult =- | { allowed: true }- | { allowed: false; errorUrl: string };+export type AccountConversionValidationResult = { allowed: true } | { allowed: false; errorUrl: string };export async function validateSamlAccountConversion(samlTenant: string | undefined,@@ -76,7 +74,10 @@ export async function validateSamlAccountConversion(): Promise<AccountConversionValidationResult> {if (!samlTenant) {// Deny by default - if tenant is missing, we cannot verify IdP authority- log.error("SAML conversion blocked - missing tenant", { emailDomain: email.split("@")[1], conversionContext });+ log.error("SAML conversion blocked - missing tenant", {+ emailDomain: email.split("@")[1],+ conversionContext,+ });return { allowed: false, errorUrl: SAML_NOT_AUTHORITATIVE_ERROR_URL };}diff --git a/packages/features/auth/lib/sendVerificationRequest.ts b/packages/features/auth/lib/sendVerificationRequest.tsindex 9b7638d5103..15bce5a2a96 100644--- a/packages/features/auth/lib/sendVerificationRequest.ts+++ b/packages/features/auth/lib/sendVerificationRequest.ts@@ -3,7 +3,7 @@ import Handlebars from "handlebars";import type { SendVerificationRequestParams } from "next-auth/providers/email";import type { TransportOptions } from "nodemailer";import nodemailer from "nodemailer";-import path from "node:path"+import path from "node:path";import { APP_NAME, WEBAPP_URL } from "@calcom/lib/constants";import { serverConfig } from "@calcom/lib/serverConfig";diff --git a/packages/features/auth/signup/utils/createOrUpdateMemberships.integration-test.ts b/packages/features/auth/signup/utils/createOrUpdateMemberships.integration-test.tsindex 54b0dcc85bd..9c8e9fcb121 100644--- a/packages/features/auth/signup/utils/createOrUpdateMemberships.integration-test.ts+++ b/packages/features/auth/signup/utils/createOrUpdateMemberships.integration-test.ts@@ -60,11 +60,7 @@ async function createTestOrganization(data: {return { ...team, organizationSettings };}-async function createTestSubteam(data: {- name: string;- slug: string;- parentId: number;-}): Promise<Team> {+async function createTestSubteam(data: { name: string; slug: string; parentId: number }): Promise<Team> {const uniqueId = generateUniqueId();const uniqueSlug = `${data.slug}-${uniqueId}`;@@ -95,10 +91,7 @@ describe("createOrUpdateMemberships Integration Tests", () => {// Clean up in reverse dependency orderawait prisma.profile.deleteMany({where: {- OR: [- { userId: { in: userIds } },- { organizationId: { in: teamIds } },- ],+ OR: [{ userId: { in: userIds } }, { organizationId: { in: teamIds } }],},});await prisma.membership.deleteMany({diff --git a/packages/features/auth/signup/utils/createOrUpdateMemberships.ts b/packages/features/auth/signup/utils/createOrUpdateMemberships.tsindex 493a1339fb9..928ba1f88f1 100644--- a/packages/features/auth/signup/utils/createOrUpdateMemberships.ts+++ b/packages/features/auth/signup/utils/createOrUpdateMemberships.ts@@ -23,10 +23,10 @@ export const createOrUpdateMemberships = async ({}) => {return await prisma.$transaction(async (tx) => {// Determine the organization context - either the team itself (if it's an org) or its parent- const organizationId = team.isOrganization ? team.id : team.parent?.id ?? null;+ const organizationId = team.isOrganization ? team.id : (team.parent?.id ?? null);const orgSettings = team.isOrganization? team.organizationSettings- : team.parent?.organizationSettings ?? null;+ : (team.parent?.organizationSettings ?? null);// Create profile if user is joining an organization context (either directly or via sub-team)if (organizationId) {diff --git a/packages/features/availability/lib/getAggregatedAvailability/getAggregatedAvailability.ts b/packages/features/availability/lib/getAggregatedAvailability/getAggregatedAvailability.tsindex 5e6f164550f..0dc5dfbb6e6 100644--- a/packages/features/availability/lib/getAggregatedAvailability/getAggregatedAvailability.ts+++ b/packages/features/availability/lib/getAggregatedAvailability/getAggregatedAvailability.ts@@ -46,14 +46,17 @@ export const getAggregatedAvailability = (const roundRobinHosts = userAvailability.filter(({ user }) => user?.isFixed !== true);if (roundRobinHosts.length) {// Group round robin hosts by their groupId- const hostsByGroup = roundRobinHosts.reduce((groups, host) => {- const groupId = host.user?.groupId || DEFAULT_GROUP_ID;- if (!groups[groupId]) {- groups[groupId] = [];- }- groups[groupId].push(host);- return groups;- }, {} as Record<string, typeof roundRobinHosts>);+ const hostsByGroup = roundRobinHosts.reduce(+ (groups, host) => {+ const groupId = host.user?.groupId || DEFAULT_GROUP_ID;+ if (!groups[groupId]) {+ groups[groupId] = [];+ }+ groups[groupId].push(host);+ return groups;+ },+ {} as Record<string, typeof roundRobinHosts>+ );// at least one host from each group needs to be availableObject.values(hostsByGroup).forEach((groupHosts) => {diff --git a/packages/features/booking-audit/di/ActorRepository.module.ts b/packages/features/booking-audit/di/ActorRepository.module.tsindex 02cf6709804..ec9cf867164 100644--- a/packages/features/booking-audit/di/ActorRepository.module.ts+++ b/packages/features/booking-audit/di/ActorRepository.module.ts@@ -8,16 +8,16 @@ export const actorRepositoryModule = createModule();const token = BOOKING_AUDIT_DI_TOKENS.AUDIT_ACTOR_REPOSITORY;const moduleToken = BOOKING_AUDIT_DI_TOKENS.AUDIT_ACTOR_REPOSITORY_MODULE;const loadModule = bindModuleToClassOnToken({- module: actorRepositoryModule,- moduleToken,- token,- classs: PrismaAuditActorRepository,- depsMap: {- prismaClient: prismaModuleLoader,- },+ module: actorRepositoryModule,+ moduleToken,+ token,+ classs: PrismaAuditActorRepository,+ depsMap: {+ prismaClient: prismaModuleLoader,+ },});export const moduleLoader = {- token,- loadModule,+ token,+ loadModule,};diff --git a/packages/features/booking-audit/di/AuditActorRepository.container.ts b/packages/features/booking-audit/di/AuditActorRepository.container.tsindex 1b32065dbe6..8cca39b2f45 100644--- a/packages/features/booking-audit/di/AuditActorRepository.container.ts+++ b/packages/features/booking-audit/di/AuditActorRepository.container.ts@@ -1,9 +1,7 @@import { createContainer } from "@calcom/features/di/di";import type { IAuditActorRepository } from "@calcom/features/booking-audit/lib/repository/IAuditActorRepository";-import {- moduleLoader as auditActorRepositoryModule,-} from "./AuditActorRepository.module";+import { moduleLoader as auditActorRepositoryModule } from "./AuditActorRepository.module";const container = createContainer();diff --git a/packages/features/booking-audit/di/AuditActorRepository.module.ts b/packages/features/booking-audit/di/AuditActorRepository.module.tsindex 0cfb3b1ae1e..85dca2e6a24 100644--- a/packages/features/booking-audit/di/AuditActorRepository.module.ts+++ b/packages/features/booking-audit/di/AuditActorRepository.module.ts@@ -8,17 +8,16 @@ export const auditActorRepositoryModule = createModule();const token = BOOKING_AUDIT_DI_TOKENS.AUDIT_ACTOR_REPOSITORY;const moduleToken = BOOKING_AUDIT_DI_TOKENS.AUDIT_ACTOR_REPOSITORY_MODULE;const loadModule = bindModuleToClassOnToken({- module: auditActorRepositoryModule,- moduleToken,- token,- classs: PrismaAuditActorRepository,- depsMap: {- prismaClient: prismaModuleLoader,- },+ module: auditActorRepositoryModule,+ moduleToken,+ token,+ classs: PrismaAuditActorRepository,+ depsMap: {+ prismaClient: prismaModuleLoader,+ },});export const moduleLoader = {- token,- loadModule,+ token,+ loadModule,};-diff --git a/packages/features/booking-audit/di/BookingAuditProducerService.container.ts b/packages/features/booking-audit/di/BookingAuditProducerService.container.tsindex 5bd4660e1a6..4e26c49a1d9 100644--- a/packages/features/booking-audit/di/BookingAuditProducerService.container.ts+++ b/packages/features/booking-audit/di/BookingAuditProducerService.container.ts@@ -1,9 +1,7 @@import { createContainer } from "@calcom/features/di/di";import type { BookingAuditProducerService } from "@calcom/features/booking-audit/lib/service/BookingAuditProducerService.interface";-import {- moduleLoader as bookingAuditTaskerProducerServiceModule,-} from "./BookingAuditTaskerProducerService.module";+import { moduleLoader as bookingAuditTaskerProducerServiceModule } from "./BookingAuditTaskerProducerService.module";const container = createContainer();@@ -12,4 +10,3 @@ export function getBookingAuditProducerService() {return container.get<BookingAuditProducerService>(bookingAuditTaskerProducerServiceModule.token);}-diff --git a/packages/features/booking-audit/di/BookingAuditTaskConsumer.container.ts b/packages/features/booking-audit/di/BookingAuditTaskConsumer.container.tsindex 162f2e1f10b..b9b0c5459be 100644--- a/packages/features/booking-audit/di/BookingAuditTaskConsumer.container.ts+++ b/packages/features/booking-audit/di/BookingAuditTaskConsumer.container.ts@@ -1,9 +1,7 @@import { createContainer } from "@calcom/features/di/di";import type { BookingAuditTaskConsumer } from "@calcom/features/booking-audit/lib/service/BookingAuditTaskConsumer";-import {- moduleLoader as bookingAuditTaskConsumerModule,-} from "./BookingAuditTaskConsumer.module";+import { moduleLoader as bookingAuditTaskConsumerModule } from "./BookingAuditTaskConsumer.module";const container = createContainer();@@ -12,4 +10,3 @@ export function getBookingAuditTaskConsumer() {return container.get<BookingAuditTaskConsumer>(bookingAuditTaskConsumerModule.token);}-diff --git a/packages/features/booking-audit/di/BookingAuditTaskConsumer.module.ts b/packages/features/booking-audit/di/BookingAuditTaskConsumer.module.tsindex 01db0143018..d29c6721f40 100644--- a/packages/features/booking-audit/di/BookingAuditTaskConsumer.module.ts+++ b/packages/features/booking-audit/di/BookingAuditTaskConsumer.module.ts@@ -28,5 +28,5 @@ const loadModule = bindModuleToClassOnToken({export const moduleLoader = {token,- loadModule+ loadModule,};diff --git a/packages/features/booking-audit/di/BookingAuditTaskerProducerService.module.ts b/packages/features/booking-audit/di/BookingAuditTaskerProducerService.module.tsindex 9466a6d8b8f..7c42279fe87 100644--- a/packages/features/booking-audit/di/BookingAuditTaskerProducerService.module.ts+++ b/packages/features/booking-audit/di/BookingAuditTaskerProducerService.module.ts@@ -24,5 +24,5 @@ const loadModule = bindModuleToClassOnToken({export const moduleLoader = {token,- loadModule+ loadModule,};diff --git a/packages/features/booking-audit/di/BookingAuditViewerService.container.ts b/packages/features/booking-audit/di/BookingAuditViewerService.container.tsindex add38c9a555..8601a81fd4a 100644--- a/packages/features/booking-audit/di/BookingAuditViewerService.container.ts+++ b/packages/features/booking-audit/di/BookingAuditViewerService.container.ts@@ -12,4 +12,3 @@ export function getBookingAuditViewerService() {return container.get<BookingAuditViewerService>(bookingAuditViewerServiceModule.token);}-diff --git a/packages/features/booking-audit/di/BookingAuditViewerService.module.ts b/packages/features/booking-audit/di/BookingAuditViewerService.module.tsindex 629297b08af..e902d0b9fb5 100644--- a/packages/features/booking-audit/di/BookingAuditViewerService.module.ts+++ b/packages/features/booking-audit/di/BookingAuditViewerService.module.ts@@ -14,7 +14,7 @@ export const bookingAuditViewerServiceModule = createModule();const token = BOOKING_AUDIT_DI_TOKENS.BOOKING_AUDIT_VIEWER_SERVICE;const moduleToken = BOOKING_AUDIT_DI_TOKENS.BOOKING_AUDIT_VIEWER_SERVICE_MODULE;-export { BookingAuditViewerService }+export { BookingAuditViewerService };const loadModule = bindModuleToClassOnToken({module: bookingAuditViewerServiceModule,@@ -34,6 +34,5 @@ const loadModule = bindModuleToClassOnToken({export const moduleLoader = {token,- loadModule+ loadModule,};-diff --git a/packages/features/booking-audit/di/tokens.ts b/packages/features/booking-audit/di/tokens.tsindex 50b03f750a5..f376e832760 100644--- a/packages/features/booking-audit/di/tokens.ts+++ b/packages/features/booking-audit/di/tokens.ts@@ -1,14 +1,14 @@export const BOOKING_AUDIT_DI_TOKENS = {- BOOKING_AUDIT_VIEWER_SERVICE: Symbol("BookingAuditViewerService"),- BOOKING_AUDIT_VIEWER_SERVICE_MODULE: Symbol("BookingAuditViewerServiceModule"),- BOOKING_AUDIT_PRODUCER_SERVICE: Symbol("BookingAuditProducerService"),- BOOKING_AUDIT_PRODUCER_SERVICE_MODULE: Symbol("BookingAuditProducerServiceModule"),- BOOKING_AUDIT_TASK_CONSUMER: Symbol("BookingAuditTaskConsumer"),- BOOKING_AUDIT_TASK_CONSUMER_MODULE: Symbol("BookingAuditTaskConsumerModule"),- BOOKING_AUDIT_REPOSITORY: Symbol("BookingAuditRepository"),- BOOKING_AUDIT_REPOSITORY_MODULE: Symbol("BookingAuditRepositoryModule"),- AUDIT_ACTOR_REPOSITORY: Symbol("AuditActorRepository"),- AUDIT_ACTOR_REPOSITORY_MODULE: Symbol("AuditActorRepositoryModule"),- BOOKING_HISTORY_VIEWER_SERVICE: Symbol("BookingHistoryViewerService"),- BOOKING_HISTORY_VIEWER_SERVICE_MODULE: Symbol("BookingHistoryViewerServiceModule"),+ BOOKING_AUDIT_VIEWER_SERVICE: Symbol("BookingAuditViewerService"),+ BOOKING_AUDIT_VIEWER_SERVICE_MODULE: Symbol("BookingAuditViewerServiceModule"),+ BOOKING_AUDIT_PRODUCER_SERVICE: Symbol("BookingAuditProducerService"),+ BOOKING_AUDIT_PRODUCER_SERVICE_MODULE: Symbol("BookingAuditProducerServiceModule"),+ BOOKING_AUDIT_TASK_CONSUMER: Symbol("BookingAuditTaskConsumer"),+ BOOKING_AUDIT_TASK_CONSUMER_MODULE: Symbol("BookingAuditTaskConsumerModule"),+ BOOKING_AUDIT_REPOSITORY: Symbol("BookingAuditRepository"),+ BOOKING_AUDIT_REPOSITORY_MODULE: Symbol("BookingAuditRepositoryModule"),+ AUDIT_ACTOR_REPOSITORY: Symbol("AuditActorRepository"),+ AUDIT_ACTOR_REPOSITORY_MODULE: Symbol("AuditActorRepositoryModule"),+ BOOKING_HISTORY_VIEWER_SERVICE: Symbol("BookingHistoryViewerService"),+ BOOKING_HISTORY_VIEWER_SERVICE_MODULE: Symbol("BookingHistoryViewerServiceModule"),};diff --git a/packages/features/booking-audit/lib/actions/AcceptedAuditActionService.ts b/packages/features/booking-audit/lib/actions/AcceptedAuditActionService.tsindex 6b66679738f..28056b5c0d5 100644--- a/packages/features/booking-audit/lib/actions/AcceptedAuditActionService.ts+++ b/packages/features/booking-audit/lib/actions/AcceptedAuditActionService.ts@@ -4,7 +4,12 @@ import { z } from "zod";import { BookingStatusChangeSchema } from "../common/changeSchemas";import type { DataRequirements } from "../service/EnrichmentDataStore";import { AuditActionServiceHelper } from "./AuditActionServiceHelper";-import type { IAuditActionService, TranslationWithParams, GetDisplayTitleParams, GetDisplayJsonParams } from "./IAuditActionService";+import type {+ IAuditActionService,+ TranslationWithParams,+ GetDisplayTitleParams,+ GetDisplayJsonParams,+} from "./IAuditActionService";/*** Accepted Audit Action Service@@ -13,75 +18,73 @@ import type { IAuditActionService, TranslationWithParams, GetDisplayTitleParams,// Module-level because it is passed to IAuditActionService type outside the class scopeconst fieldsSchemaV1 = z.object({- status: BookingStatusChangeSchema,+ status: BookingStatusChangeSchema,});export class AcceptedAuditActionService implements IAuditActionService {- readonly VERSION = 1;- public static readonly TYPE = "ACCEPTED" as const;- private static dataSchemaV1 = z.object({- version: z.literal(1),- fields: fieldsSchemaV1,- });- private static fieldsSchemaV1 = fieldsSchemaV1;- public static readonly latestFieldsSchema = fieldsSchemaV1;- // Union of all versions- public static readonly storedDataSchema = AcceptedAuditActionService.dataSchemaV1;- // Union of all versions- public static readonly storedFieldsSchema = AcceptedAuditActionService.fieldsSchemaV1;- private helper: AuditActionServiceHelper<- typeof AcceptedAuditActionService.latestFieldsSchema,- typeof AcceptedAuditActionService.storedDataSchema- >;+ readonly VERSION = 1;+ public static readonly TYPE = "ACCEPTED" as const;+ private static dataSchemaV1 = z.object({+ version: z.literal(1),+ fields: fieldsSchemaV1,+ });+ private static fieldsSchemaV1 = fieldsSchemaV1;+ public static readonly latestFieldsSchema = fieldsSchemaV1;+ // Union of all versions+ public static readonly storedDataSchema = AcceptedAuditActionService.dataSchemaV1;+ // Union of all versions+ public static readonly storedFieldsSchema = AcceptedAuditActionService.fieldsSchemaV1;+ private helper: AuditActionServiceHelper<+ typeof AcceptedAuditActionService.latestFieldsSchema,+ typeof AcceptedAuditActionService.storedDataSchema+ >;- constructor() {- this.helper = new AuditActionServiceHelper({- latestVersion: this.VERSION,- latestFieldsSchema: AcceptedAuditActionService.latestFieldsSchema,- storedDataSchema: AcceptedAuditActionService.storedDataSchema,- });- }+ constructor() {+ this.helper = new AuditActionServiceHelper({+ latestVersion: this.VERSION,+ latestFieldsSchema: AcceptedAuditActionService.latestFieldsSchema,+ storedDataSchema: AcceptedAuditActionService.storedDataSchema,+ });+ }- getVersionedData(fields: unknown) {- return this.helper.getVersionedData(fields);- }+ getVersionedData(fields: unknown) {+ return this.helper.getVersionedData(fields);+ }- parseStored(data: unknown) {- return this.helper.parseStored(data);- }+ parseStored(data: unknown) {+ return this.helper.parseStored(data);+ }- getVersion(data: unknown): number {- return this.helper.getVersion(data);- }+ getVersion(data: unknown): number {+ return this.helper.getVersion(data);+ }- migrateToLatest(data: unknown) {- // V1-only: validate and return as-is (no migration needed)- const validated = fieldsSchemaV1.parse(data);- return { isMigrated: false, latestData: validated };- }+ migrateToLatest(data: unknown) {+ // V1-only: validate and return as-is (no migration needed)+ const validated = fieldsSchemaV1.parse(data);+ return { isMigrated: false, latestData: validated };+ }- getDataRequirements(): DataRequirements {- return { userUuids: [] };- }+ getDataRequirements(): DataRequirements {+ return { userUuids: [] };+ }- async getDisplayTitle(_: GetDisplayTitleParams): Promise<TranslationWithParams> {- return { key: "booking_audit_action.accepted" };- }+ async getDisplayTitle(_: GetDisplayTitleParams): Promise<TranslationWithParams> {+ return { key: "booking_audit_action.accepted" };+ }- getDisplayJson({- storedData,- }: GetDisplayJsonParams): AcceptedAuditDisplayData {- const { fields } = this.parseStored({ version: storedData.version, fields: storedData.fields });- return {- previousStatus: fields.status.old ?? null,- newStatus: fields.status.new ?? null,- };- }+ getDisplayJson({ storedData }: GetDisplayJsonParams): AcceptedAuditDisplayData {+ const { fields } = this.parseStored({ version: storedData.version, fields: storedData.fields });+ return {+ previousStatus: fields.status.old ?? null,+ newStatus: fields.status.new ?? null,+ };+ }}export type AcceptedAuditData = z.infer<typeof fieldsSchemaV1>;export type AcceptedAuditDisplayData = {- previousStatus: BookingStatus | null;- newStatus: BookingStatus | null;+ previousStatus: BookingStatus | null;+ newStatus: BookingStatus | null;};diff --git a/packages/features/booking-audit/lib/actions/AttendeeRemovedAuditActionService.ts b/packages/features/booking-audit/lib/actions/AttendeeRemovedAuditActionService.tsindex 82b23c1e962..75909fbbc74 100644--- a/packages/features/booking-audit/lib/actions/AttendeeRemovedAuditActionService.ts+++ b/packages/features/booking-audit/lib/actions/AttendeeRemovedAuditActionService.ts@@ -3,7 +3,12 @@ import { z } from "zod";import { StringArrayChangeSchema } from "../common/changeSchemas";import type { DataRequirements } from "../service/EnrichmentDataStore";import { AuditActionServiceHelper } from "./AuditActionServiceHelper";-import type { IAuditActionService, TranslationWithParams, GetDisplayTitleParams, GetDisplayJsonParams } from "./IAuditActionService";+import type {+ IAuditActionService,+ TranslationWithParams,+ GetDisplayTitleParams,+ GetDisplayJsonParams,+} from "./IAuditActionService";/*** Attendee Removed Audit Action Service@@ -12,77 +17,75 @@ import type { IAuditActionService, TranslationWithParams, GetDisplayTitleParams,// Module-level because it is passed to IAuditActionService type outside the class scopeconst fieldsSchemaV1 = z.object({- attendees: StringArrayChangeSchema,+ attendees: StringArrayChangeSchema,});export class AttendeeRemovedAuditActionService implements IAuditActionService {- readonly VERSION = 1;- public static readonly TYPE = "ATTENDEE_REMOVED" as const;- private static dataSchemaV1 = z.object({- version: z.literal(1),- fields: fieldsSchemaV1,- });- private static fieldsSchemaV1 = fieldsSchemaV1;- public static readonly latestFieldsSchema = fieldsSchemaV1;- // Union of all versions- public static readonly storedDataSchema = AttendeeRemovedAuditActionService.dataSchemaV1;- // Union of all versions- public static readonly storedFieldsSchema = AttendeeRemovedAuditActionService.fieldsSchemaV1;- private helper: AuditActionServiceHelper<- typeof AttendeeRemovedAuditActionService.latestFieldsSchema,- typeof AttendeeRemovedAuditActionService.storedDataSchema- >;+ readonly VERSION = 1;+ public static readonly TYPE = "ATTENDEE_REMOVED" as const;+ private static dataSchemaV1 = z.object({+ version: z.literal(1),+ fields: fieldsSchemaV1,+ });+ private static fieldsSchemaV1 = fieldsSchemaV1;+ public static readonly latestFieldsSchema = fieldsSchemaV1;+ // Union of all versions+ public static readonly storedDataSchema = AttendeeRemovedAuditActionService.dataSchemaV1;+ // Union of all versions+ public static readonly storedFieldsSchema = AttendeeRemovedAuditActionService.fieldsSchemaV1;+ private helper: AuditActionServiceHelper<+ typeof AttendeeRemovedAuditActionService.latestFieldsSchema,+ typeof AttendeeRemovedAuditActionService.storedDataSchema+ >;- constructor() {- this.helper = new AuditActionServiceHelper({- latestVersion: this.VERSION,- latestFieldsSchema: AttendeeRemovedAuditActionService.latestFieldsSchema,- storedDataSchema: AttendeeRemovedAuditActionService.storedDataSchema,- });- }+ constructor() {+ this.helper = new AuditActionServiceHelper({+ latestVersion: this.VERSION,+ latestFieldsSchema: AttendeeRemovedAuditActionService.latestFieldsSchema,+ storedDataSchema: AttendeeRemovedAuditActionService.storedDataSchema,+ });+ }- getVersionedData(fields: unknown) {- return this.helper.getVersionedData(fields);- }+ getVersionedData(fields: unknown) {+ return this.helper.getVersionedData(fields);+ }- parseStored(data: unknown) {- return this.helper.parseStored(data);- }+ parseStored(data: unknown) {+ return this.helper.parseStored(data);+ }- getVersion(data: unknown): number {- return this.helper.getVersion(data);- }+ getVersion(data: unknown): number {+ return this.helper.getVersion(data);+ }- migrateToLatest(data: unknown) {- // V1-only: validate and return as-is (no migration needed)- const validated = fieldsSchemaV1.parse(data);- return { isMigrated: false, latestData: validated };- }+ migrateToLatest(data: unknown) {+ // V1-only: validate and return as-is (no migration needed)+ const validated = fieldsSchemaV1.parse(data);+ return { isMigrated: false, latestData: validated };+ }- getDataRequirements(): DataRequirements {- return { userUuids: [] };- }+ getDataRequirements(): DataRequirements {+ return { userUuids: [] };+ }- async getDisplayTitle(_: GetDisplayTitleParams): Promise<TranslationWithParams> {- return { key: "booking_audit_action.attendee_removed" };- }+ async getDisplayTitle(_: GetDisplayTitleParams): Promise<TranslationWithParams> {+ return { key: "booking_audit_action.attendee_removed" };+ }- getDisplayJson({- storedData,- }: GetDisplayJsonParams): AttendeeRemovedAuditDisplayData {- const { fields } = this.parseStored({ version: storedData.version, fields: storedData.fields });- const remainingAttendeesSet = new Set(fields.attendees.new ?? []);- const removedAttendees = (fields.attendees.old ?? []).filter(- (email) => !remainingAttendeesSet.has(email)- );- return {- removedAttendees,- };- }+ getDisplayJson({ storedData }: GetDisplayJsonParams): AttendeeRemovedAuditDisplayData {+ const { fields } = this.parseStored({ version: storedData.version, fields: storedData.fields });+ const remainingAttendeesSet = new Set(fields.attendees.new ?? []);+ const removedAttendees = (fields.attendees.old ?? []).filter(+ (email) => !remainingAttendeesSet.has(email)+ );+ return {+ removedAttendees,+ };+ }}export type AttendeeRemovedAuditData = z.infer<typeof fieldsSchemaV1>;export type AttendeeRemovedAuditDisplayData = {- removedAttendees: string[];+ removedAttendees: string[];};diff --git a/packages/features/booking-audit/lib/actions/AuditActionServiceHelper.ts b/packages/features/booking-audit/lib/actions/AuditActionServiceHelper.tsindex e5a0a63ecbb..3177c6a3ca4 100644--- a/packages/features/booking-audit/lib/actions/AuditActionServiceHelper.ts+++ b/packages/features/booking-audit/lib/actions/AuditActionServiceHelper.ts@@ -3,14 +3,14 @@ import { formatInTimeZone } from "date-fns-tz";/*** Audit Action Service Helper- *+ ** Provides reusable utility methods for audit action services via composition.- *+ ** We use composition instead of inheritance for Action services so that services can evolve to v2, v3 independently without polluting a shared base class*/export class AuditActionServiceHelper<TLatestFieldsSchema extends z.ZodTypeAny,- TStoredDataSchema extends z.ZodTypeAny+ TStoredDataSchema extends z.ZodTypeAny,> {private readonly latestFieldsSchema: TLatestFieldsSchema;private readonly latestVersion: number;@@ -83,4 +83,3 @@ export class AuditActionServiceHelper<return formatInTimeZone(new Date(date), timeZone, "yyyy-MM-dd HH:mm:ss");}}-diff --git a/packages/features/booking-audit/lib/actions/CancelledAuditActionService.ts b/packages/features/booking-audit/lib/actions/CancelledAuditActionService.tsindex 2c9a1d6be91..672f0da1978 100644--- a/packages/features/booking-audit/lib/actions/CancelledAuditActionService.ts+++ b/packages/features/booking-audit/lib/actions/CancelledAuditActionService.ts@@ -3,7 +3,12 @@ import { z } from "zod";import { BookingStatusChangeSchema } from "../common/changeSchemas";import type { DataRequirements } from "../service/EnrichmentDataStore";import { AuditActionServiceHelper } from "./AuditActionServiceHelper";-import type { IAuditActionService, TranslationWithParams, GetDisplayTitleParams, GetDisplayJsonParams } from "./IAuditActionService";+import type {+ IAuditActionService,+ TranslationWithParams,+ GetDisplayTitleParams,+ GetDisplayJsonParams,+} from "./IAuditActionService";/*** Cancelled Audit Action Service@@ -12,81 +17,79 @@ import type { IAuditActionService, TranslationWithParams, GetDisplayTitleParams,// Module-level because it is passed to IAuditActionService type outside the class scopeconst fieldsSchemaV1 = z.object({- cancellationReason: z.string().nullable(),- cancelledBy: z.string().nullable(),- status: BookingStatusChangeSchema,+ cancellationReason: z.string().nullable(),+ cancelledBy: z.string().nullable(),+ status: BookingStatusChangeSchema,});export class CancelledAuditActionService implements IAuditActionService {- readonly VERSION = 1;- public static readonly TYPE = "CANCELLED" as const;- private static dataSchemaV1 = z.object({- version: z.literal(1),- fields: fieldsSchemaV1,- });- private static fieldsSchemaV1 = fieldsSchemaV1;- public static readonly latestFieldsSchema = fieldsSchemaV1;- // Union of all versions- public static readonly storedDataSchema = CancelledAuditActionService.dataSchemaV1;- // Union of all versions- public static readonly storedFieldsSchema = CancelledAuditActionService.fieldsSchemaV1;- private helper: AuditActionServiceHelper<- typeof CancelledAuditActionService.latestFieldsSchema,- typeof CancelledAuditActionService.storedDataSchema- >;+ readonly VERSION = 1;+ public static readonly TYPE = "CANCELLED" as const;+ private static dataSchemaV1 = z.object({+ version: z.literal(1),+ fields: fieldsSchemaV1,+ });+ private static fieldsSchemaV1 = fieldsSchemaV1;+ public static readonly latestFieldsSchema = fieldsSchemaV1;+ // Union of all versions+ public static readonly storedDataSchema = CancelledAuditActionService.dataSchemaV1;+ // Union of all versions+ public static readonly storedFieldsSchema = CancelledAuditActionService.fieldsSchemaV1;+ private helper: AuditActionServiceHelper<+ typeof CancelledAuditActionService.latestFieldsSchema,+ typeof CancelledAuditActionService.storedDataSchema+ >;- constructor() {- this.helper = new AuditActionServiceHelper({- latestVersion: this.VERSION,- latestFieldsSchema: CancelledAuditActionService.latestFieldsSchema,- storedDataSchema: CancelledAuditActionService.storedDataSchema,- });- }+ constructor() {+ this.helper = new AuditActionServiceHelper({+ latestVersion: this.VERSION,+ latestFieldsSchema: CancelledAuditActionService.latestFieldsSchema,+ storedDataSchema: CancelledAuditActionService.storedDataSchema,+ });+ }- getVersionedData(fields: unknown) {- return this.helper.getVersionedData(fields);- }+ getVersionedData(fields: unknown) {+ return this.helper.getVersionedData(fields);+ }- parseStored(data: unknown) {- return this.helper.parseStored(data);- }+ parseStored(data: unknown) {+ return this.helper.parseStored(data);+ }- getVersion(data: unknown): number {- return this.helper.getVersion(data);- }+ getVersion(data: unknown): number {+ return this.helper.getVersion(data);+ }- migrateToLatest(data: unknown) {- // V1-only: validate and return as-is (no migration needed)- const validated = fieldsSchemaV1.parse(data);- return { isMigrated: false, latestData: validated };- }+ migrateToLatest(data: unknown) {+ // V1-only: validate and return as-is (no migration needed)+ const validated = fieldsSchemaV1.parse(data);+ return { isMigrated: false, latestData: validated };+ }- getDataRequirements(): DataRequirements {- return { userUuids: [] };- }+ getDataRequirements(): DataRequirements {+ return { userUuids: [] };+ }- async getDisplayTitle(_: GetDisplayTitleParams): Promise<TranslationWithParams> {- return { key: "booking_audit_action.cancelled" };- }+ async getDisplayTitle(_: GetDisplayTitleParams): Promise<TranslationWithParams> {+ return { key: "booking_audit_action.cancelled" };+ }- getDisplayJson({- storedData,- }: GetDisplayJsonParams): CancelledAuditDisplayData {- const { fields } = this.parseStored({ version: storedData.version, fields: storedData.fields });- return {- cancellationReason: fields.cancellationReason ?? null,- cancelledBy: fields.cancelledBy ?? null,- previousStatus: fields.status.old ?? null,- newStatus: fields.status.new ?? null,- };- }+ getDisplayJson({ storedData }: GetDisplayJsonParams): CancelledAuditDisplayData {+ const { fields } = this.parseStored({ version: storedData.version, fields: storedData.fields });+ return {+ cancellationReason: fields.cancellationReason ?? null,+ cancelledBy: fields.cancelledBy ?? null,+ previousStatus: fields.status.old ?? null,+ newStatus: fields.status.new ?? null,+ };+ }}export type CancelledAuditData = z.infer<typeof fieldsSchemaV1>;export type CancelledAuditDisplayData = {- cancellationReason: string | null;- cancelledBy: string | null;- previousStatus: string | null;- newStatus: string | null;+ cancellationReason: string | null;+ cancelledBy: string | null;+ previousStatus: string | null;+ newStatus: string | null;};diff --git a/packages/features/booking-audit/lib/actions/CreatedAuditActionService.ts b/packages/features/booking-audit/lib/actions/CreatedAuditActionService.tsindex fff749b7a86..83106534f24 100644--- a/packages/features/booking-audit/lib/actions/CreatedAuditActionService.ts+++ b/packages/features/booking-audit/lib/actions/CreatedAuditActionService.ts@@ -2,105 +2,110 @@ import { z } from "zod";import { BookingStatus } from "@calcom/prisma/enums";import { AuditActionServiceHelper } from "./AuditActionServiceHelper";-import type { IAuditActionService, TranslationWithParams, GetDisplayTitleParams, GetDisplayJsonParams, BaseStoredAuditData } from "./IAuditActionService";+import type {+ IAuditActionService,+ TranslationWithParams,+ GetDisplayTitleParams,+ GetDisplayJsonParams,+ BaseStoredAuditData,+} from "./IAuditActionService";import type { DataRequirements } from "../service/EnrichmentDataStore";/*** Created Audit Action Service- *+ ** Note: CREATED action captures initial state, so it doesn't use { old, new } pattern*/// Module-level because it is passed to IAuditActionService type outside the class scopeconst fieldsSchemaV1 = z.object({- startTime: z.number(),- endTime: z.number(),- status: z.nativeEnum(BookingStatus),- hostUserUuid: z.string().nullable(),- // Allowing it to be optional because most of the time(non-seated booking) it won't be there- seatReferenceUid: z.string().nullish(),+ startTime: z.number(),+ endTime: z.number(),+ status: z.nativeEnum(BookingStatus),+ hostUserUuid: z.string().nullable(),+ // Allowing it to be optional because most of the time(non-seated booking) it won't be there+ seatReferenceUid: z.string().nullish(),});export class CreatedAuditActionService implements IAuditActionService {- readonly VERSION = 1;- public static readonly TYPE = "CREATED" as const;- private static dataSchemaV1 = z.object({- version: z.literal(1),- fields: fieldsSchemaV1,+ readonly VERSION = 1;+ public static readonly TYPE = "CREATED" as const;+ private static dataSchemaV1 = z.object({+ version: z.literal(1),+ fields: fieldsSchemaV1,+ });+ private static fieldsSchemaV1 = fieldsSchemaV1;+ public static readonly latestFieldsSchema = fieldsSchemaV1;+ // Union of all versions+ public static readonly storedDataSchema = CreatedAuditActionService.dataSchemaV1;+ // Union of all versions+ public static readonly storedFieldsSchema = CreatedAuditActionService.fieldsSchemaV1;+ private helper: AuditActionServiceHelper<+ typeof CreatedAuditActionService.latestFieldsSchema,+ typeof CreatedAuditActionService.storedDataSchema+ >;++ constructor() {+ this.helper = new AuditActionServiceHelper({+ latestVersion: this.VERSION,+ latestFieldsSchema: CreatedAuditActionService.latestFieldsSchema,+ storedDataSchema: CreatedAuditActionService.storedDataSchema,});- private static fieldsSchemaV1 = fieldsSchemaV1;- public static readonly latestFieldsSchema = fieldsSchemaV1;- // Union of all versions- public static readonly storedDataSchema = CreatedAuditActionService.dataSchemaV1;- // Union of all versions- public static readonly storedFieldsSchema = CreatedAuditActionService.fieldsSchemaV1;- private helper: AuditActionServiceHelper<typeof CreatedAuditActionService.latestFieldsSchema, typeof CreatedAuditActionService.storedDataSchema>;-- constructor() {- this.helper = new AuditActionServiceHelper({- latestVersion: this.VERSION,- latestFieldsSchema: CreatedAuditActionService.latestFieldsSchema,- storedDataSchema: CreatedAuditActionService.storedDataSchema,- });- }-- getVersionedData(fields: unknown) {- return this.helper.getVersionedData(fields);- }-- parseStored(data: unknown) {- return this.helper.parseStored(data);- }-- getVersion(data: unknown): number {- return this.helper.getVersion(data);- }-- migrateToLatest(data: unknown) {- // V1-only: validate and return as-is (no migration needed)- const validated = fieldsSchemaV1.parse(data);- return { isMigrated: false, latestData: validated };- }-- getDataRequirements(storedData: BaseStoredAuditData): DataRequirements {- const { fields } = this.parseStored(storedData);- return {- userUuids: fields.hostUserUuid ? [fields.hostUserUuid] : [],- };- }-- async getDisplayTitle({ storedData, dbStore }: GetDisplayTitleParams): Promise<TranslationWithParams> {- const { fields } = this.parseStored(storedData);- const hostUser = fields.hostUserUuid ? dbStore.getUserByUuid(fields.hostUserUuid) : null;- const hostName = hostUser?.name || "Unknown";- if (fields.seatReferenceUid) {- return { key: "booking_audit_action.created_with_seat", params: { host: hostName } };- }- return { key: "booking_audit_action.created", params: { host: hostName } };- }-- getDisplayJson({- storedData,- userTimeZone,- }: GetDisplayJsonParams): CreatedAuditDisplayData {- const { fields } = this.parseStored({ version: storedData.version, fields: storedData.fields });- const timeZone = userTimeZone;-- return {- startTime: AuditActionServiceHelper.formatDateTimeInTimeZone(fields.startTime, timeZone),- endTime: AuditActionServiceHelper.formatDateTimeInTimeZone(fields.endTime, timeZone),- status: fields.status,- ...(fields.seatReferenceUid ? { seatReferenceUid: fields.seatReferenceUid } : {}),- };+ }++ getVersionedData(fields: unknown) {+ return this.helper.getVersionedData(fields);+ }++ parseStored(data: unknown) {+ return this.helper.parseStored(data);+ }++ getVersion(data: unknown): number {+ return this.helper.getVersion(data);+ }++ migrateToLatest(data: unknown) {+ // V1-only: validate and return as-is (no migration needed)+ const validated = fieldsSchemaV1.parse(data);+ return { isMigrated: false, latestData: validated };+ }++ getDataRequirements(storedData: BaseStoredAuditData): DataRequirements {+ const { fields } = this.parseStored(storedData);+ return {+ userUuids: fields.hostUserUuid ? [fields.hostUserUuid] : [],+ };+ }++ async getDisplayTitle({ storedData, dbStore }: GetDisplayTitleParams): Promise<TranslationWithParams> {+ const { fields } = this.parseStored(storedData);+ const hostUser = fields.hostUserUuid ? dbStore.getUserByUuid(fields.hostUserUuid) : null;+ const hostName = hostUser?.name || "Unknown";+ if (fields.seatReferenceUid) {+ return { key: "booking_audit_action.created_with_seat", params: { host: hostName } };}+ return { key: "booking_audit_action.created", params: { host: hostName } };+ }++ getDisplayJson({ storedData, userTimeZone }: GetDisplayJsonParams): CreatedAuditDisplayData {+ const { fields } = this.parseStored({ version: storedData.version, fields: storedData.fields });+ const timeZone = userTimeZone;++ return {+ startTime: AuditActionServiceHelper.formatDateTimeInTimeZone(fields.startTime, timeZone),+ endTime: AuditActionServiceHelper.formatDateTimeInTimeZone(fields.endTime, timeZone),+ status: fields.status,+ ...(fields.seatReferenceUid ? { seatReferenceUid: fields.seatReferenceUid } : {}),+ };+ }}export type CreatedAuditData = z.infer<typeof fieldsSchemaV1>;export type CreatedAuditDisplayData = {- startTime: string;- endTime: string;- status: BookingStatus;- seatReferenceUid?: string;+ startTime: string;+ endTime: string;+ status: BookingStatus;+ seatReferenceUid?: string;};-diff --git a/packages/features/booking-audit/lib/actions/NoShowUpdatedAuditActionService.ts b/packages/features/booking-audit/lib/actions/NoShowUpdatedAuditActionService.tsindex 91f5f9a3d71..7cec3f7e78c 100644--- a/packages/features/booking-audit/lib/actions/NoShowUpdatedAuditActionService.ts+++ b/packages/features/booking-audit/lib/actions/NoShowUpdatedAuditActionService.ts@@ -95,7 +95,10 @@ export class NoShowUpdatedAuditActionService implements IAuditActionService {}async getDisplayTitle({ storedData }: GetDisplayTitleParams): Promise<TranslationWithParams> {- const { fields: parsedFields } = this.parseStored({ version: storedData.version, fields: storedData.fields });+ const { fields: parsedFields } = this.parseStored({+ version: storedData.version,+ fields: storedData.fields,+ });if (this.isHostSet(parsedFields) && this.isAttendeesNoShowSet(parsedFields)) {return { key: "booking_audit_action.no_show_updated" };}diff --git a/packages/features/booking-audit/lib/actions/RescheduledAuditActionService.ts b/packages/features/booking-audit/lib/actions/RescheduledAuditActionService.tsindex f5ea5cd69c8..c6e8961bea5 100644--- a/packages/features/booking-audit/lib/actions/RescheduledAuditActionService.ts+++ b/packages/features/booking-audit/lib/actions/RescheduledAuditActionService.ts@@ -3,7 +3,13 @@ import { z } from "zod";import { NumberChangeSchema, StringChangeSchema } from "../common/changeSchemas";import type { DataRequirements } from "../service/EnrichmentDataStore";import { AuditActionServiceHelper } from "./AuditActionServiceHelper";-import type { IAuditActionService, TranslationWithParams, GetDisplayTitleParams, GetDisplayJsonParams, BaseStoredAuditData } from "./IAuditActionService";+import type {+ IAuditActionService,+ TranslationWithParams,+ GetDisplayTitleParams,+ GetDisplayJsonParams,+ BaseStoredAuditData,+} from "./IAuditActionService";/*** Rescheduled Audit Action Service@@ -12,166 +18,164 @@ import type { IAuditActionService, TranslationWithParams, GetDisplayTitleParams,// Module-level because it is passed to IAuditActionService type outside the class scopeconst fieldsSchemaV1 = z.object({- startTime: NumberChangeSchema,- endTime: NumberChangeSchema,- rescheduledToUid: StringChangeSchema,+ startTime: NumberChangeSchema,+ endTime: NumberChangeSchema,+ rescheduledToUid: StringChangeSchema,});export class RescheduledAuditActionService implements IAuditActionService {- readonly VERSION = 1;- public static readonly TYPE = "RESCHEDULED" as const;- private static dataSchemaV1 = z.object({- version: z.literal(1),- fields: fieldsSchemaV1,+ readonly VERSION = 1;+ public static readonly TYPE = "RESCHEDULED" as const;+ private static dataSchemaV1 = z.object({+ version: z.literal(1),+ fields: fieldsSchemaV1,+ });+ private static fieldsSchemaV1 = fieldsSchemaV1;+ public static readonly latestFieldsSchema = fieldsSchemaV1;+ // Union of all versions+ public static readonly storedDataSchema = RescheduledAuditActionService.dataSchemaV1;+ // Union of all versions+ public static readonly storedFieldsSchema = RescheduledAuditActionService.fieldsSchemaV1;+ private helper: AuditActionServiceHelper<+ typeof RescheduledAuditActionService.latestFieldsSchema,+ typeof RescheduledAuditActionService.storedDataSchema+ >;++ constructor() {+ this.helper = new AuditActionServiceHelper({+ latestVersion: this.VERSION,+ latestFieldsSchema: RescheduledAuditActionService.latestFieldsSchema,+ storedDataSchema: RescheduledAuditActionService.storedDataSchema,});- private static fieldsSchemaV1 = fieldsSchemaV1;- public static readonly latestFieldsSchema = fieldsSchemaV1;- // Union of all versions- public static readonly storedDataSchema = RescheduledAuditActionService.dataSchemaV1;- // Union of all versions- public static readonly storedFieldsSchema = RescheduledAuditActionService.fieldsSchemaV1;- private helper: AuditActionServiceHelper<- typeof RescheduledAuditActionService.latestFieldsSchema,- typeof RescheduledAuditActionService.storedDataSchema- >;-- constructor() {- this.helper = new AuditActionServiceHelper({- latestVersion: this.VERSION,- latestFieldsSchema: RescheduledAuditActionService.latestFieldsSchema,- storedDataSchema: RescheduledAuditActionService.storedDataSchema,- });- }-- getVersionedData(fields: unknown) {- return this.helper.getVersionedData(fields);- }-- parseStored(data: unknown) {- return this.helper.parseStored(data);- }-- getVersion(data: unknown): number {- return this.helper.getVersion(data);- }-- migrateToLatest(data: unknown) {- // V1-only: validate and return as-is (no migration needed)- const validated = fieldsSchemaV1.parse(data);- return { isMigrated: false, latestData: validated };- }-- getDataRequirements(): DataRequirements {- return { userUuids: [] };- }-- async getDisplayTitle({- storedData,- userTimeZone,- }: GetDisplayTitleParams): Promise<TranslationWithParams> {- const { fields } = this.parseStored(storedData);- const rescheduledToUid = fields.rescheduledToUid.new;- const timeZone = userTimeZone;-- // Format dates in user timezone- const oldDate = fields.startTime.old- ? AuditActionServiceHelper.formatDateInTimeZone(fields.startTime.old, timeZone)- : "";- const newDate = fields.startTime.new- ? AuditActionServiceHelper.formatDateInTimeZone(fields.startTime.new, timeZone)- : "";-- return {- key: "booking_audit_action.rescheduled",- params: {- oldDate,- newDate,- },- components: rescheduledToUid ? [{ type: "link", href: `/booking/${rescheduledToUid}/logs` }] : undefined,- };- }-- getDisplayTitleForRescheduledFromLog({- fromRescheduleUid,- userTimeZone,- storedData,- }: {- fromRescheduleUid: string;- userTimeZone: string;- storedData: BaseStoredAuditData;- }): TranslationWithParams {- const timeZone = userTimeZone;- const { fields } = this.parseStored(storedData);-- // Format dates in user timezone- const oldDate = fields.startTime.old- ? AuditActionServiceHelper.formatDateInTimeZone(fields.startTime.old, timeZone)- : "";- const newDate = fields.startTime.new- ? AuditActionServiceHelper.formatDateInTimeZone(fields.startTime.new, timeZone)- : "";-- return {- key: "booking_audit_action.rescheduled_from",- params: {- oldDate,- newDate,- },- components: [{ type: "link", href: `/booking/${fromRescheduleUid}/logs` }],- };- }-- getDisplayJson({- storedData,- userTimeZone,- }: GetDisplayJsonParams): RescheduledAuditDisplayData {- const { fields } = this.parseStored({ version: storedData.version, fields: storedData.fields });- const timeZone = userTimeZone;-- return {- previousStartTime: fields.startTime.old- ? AuditActionServiceHelper.formatDateTimeInTimeZone(fields.startTime.old, timeZone)- : null,- newStartTime: fields.startTime.new- ? AuditActionServiceHelper.formatDateTimeInTimeZone(fields.startTime.new, timeZone)- : null,- previousEndTime: fields.endTime.old- ? AuditActionServiceHelper.formatDateTimeInTimeZone(fields.endTime.old, timeZone)- : null,- newEndTime: fields.endTime.new- ? AuditActionServiceHelper.formatDateTimeInTimeZone(fields.endTime.new, timeZone)- : null,- rescheduledToUid: fields.rescheduledToUid.new ?? null,- };- }-- /**- * Finds the rescheduled log that created a specific booking- * by matching the rescheduledToUid field with the target booking UID- * @param rescheduledLogs - Array of rescheduled audit logs to search through- * @param rescheduledToBookingUid - The UID of the booking that was created from the reschedule- * @returns The matching log or null if not found- */- getMatchingLog<T extends { data: unknown }>({- rescheduledLogs,- rescheduledToBookingUid,- }: {- rescheduledLogs: T[];- rescheduledToBookingUid: string;- }): T | null {- return rescheduledLogs.find((log) => {- const parsedData = this.parseStored(log.data);- return parsedData.fields.rescheduledToUid.new === rescheduledToBookingUid;- }) ?? null;- }+ }++ getVersionedData(fields: unknown) {+ return this.helper.getVersionedData(fields);+ }++ parseStored(data: unknown) {+ return this.helper.parseStored(data);+ }++ getVersion(data: unknown): number {+ return this.helper.getVersion(data);+ }++ migrateToLatest(data: unknown) {+ // V1-only: validate and return as-is (no migration needed)+ const validated = fieldsSchemaV1.parse(data);+ return { isMigrated: false, latestData: validated };+ }++ getDataRequirements(): DataRequirements {+ return { userUuids: [] };+ }++ async getDisplayTitle({ storedData, userTimeZone }: GetDisplayTitleParams): Promise<TranslationWithParams> {+ const { fields } = this.parseStored(storedData);+ const rescheduledToUid = fields.rescheduledToUid.new;+ const timeZone = userTimeZone;++ // Format dates in user timezone+ const oldDate = fields.startTime.old+ ? AuditActionServiceHelper.formatDateInTimeZone(fields.startTime.old, timeZone)+ : "";+ const newDate = fields.startTime.new+ ? AuditActionServiceHelper.formatDateInTimeZone(fields.startTime.new, timeZone)+ : "";++ return {+ key: "booking_audit_action.rescheduled",+ params: {+ oldDate,+ newDate,+ },+ components: rescheduledToUid+ ? [{ type: "link", href: `/booking/${rescheduledToUid}/logs` }]+ : undefined,+ };+ }++ getDisplayTitleForRescheduledFromLog({+ fromRescheduleUid,+ userTimeZone,+ storedData,+ }: {+ fromRescheduleUid: string;+ userTimeZone: string;+ storedData: BaseStoredAuditData;+ }): TranslationWithParams {+ const timeZone = userTimeZone;+ const { fields } = this.parseStored(storedData);++ // Format dates in user timezone+ const oldDate = fields.startTime.old+ ? AuditActionServiceHelper.formatDateInTimeZone(fields.startTime.old, timeZone)+ : "";+ const newDate = fields.startTime.new+ ? AuditActionServiceHelper.formatDateInTimeZone(fields.startTime.new, timeZone)+ : "";++ return {+ key: "booking_audit_action.rescheduled_from",+ params: {+ oldDate,+ newDate,+ },+ components: [{ type: "link", href: `/booking/${fromRescheduleUid}/logs` }],+ };+ }++ getDisplayJson({ storedData, userTimeZone }: GetDisplayJsonParams): RescheduledAuditDisplayData {+ const { fields } = this.parseStored({ version: storedData.version, fields: storedData.fields });+ const timeZone = userTimeZone;++ return {+ previousStartTime: fields.startTime.old+ ? AuditActionServiceHelper.formatDateTimeInTimeZone(fields.startTime.old, timeZone)+ : null,+ newStartTime: fields.startTime.new+ ? AuditActionServiceHelper.formatDateTimeInTimeZone(fields.startTime.new, timeZone)+ : null,+ previousEndTime: fields.endTime.old+ ? AuditActionServiceHelper.formatDateTimeInTimeZone(fields.endTime.old, timeZone)+ : null,+ newEndTime: fields.endTime.new+ ? AuditActionServiceHelper.formatDateTimeInTimeZone(fields.endTime.new, timeZone)+ : null,+ rescheduledToUid: fields.rescheduledToUid.new ?? null,+ };+ }++ /**+ * Finds the rescheduled log that created a specific booking+ * by matching the rescheduledToUid field with the target booking UID+ * @param rescheduledLogs - Array of rescheduled audit logs to search through+ * @param rescheduledToBookingUid - The UID of the booking that was created from the reschedule+ * @returns The matching log or null if not found+ */+ getMatchingLog<T extends { data: unknown }>({+ rescheduledLogs,+ rescheduledToBookingUid,+ }: {+ rescheduledLogs: T[];+ rescheduledToBookingUid: string;+ }): T | null {+ return (+ rescheduledLogs.find((log) => {+ const parsedData = this.parseStored(log.data);+ return parsedData.fields.rescheduledToUid.new === rescheduledToBookingUid;+ }) ?? null+ );+ }}export type RescheduledAuditData = z.infer<typeof fieldsSchemaV1>;export type RescheduledAuditDisplayData = {- previousStartTime: string | null;- newStartTime: string | null;- previousEndTime: string | null;- newEndTime: string | null;- rescheduledToUid: string | null;+ previousStartTime: string | null;+ newStartTime: string | null;+ previousEndTime: string | null;+ newEndTime: string | null;+ rescheduledToUid: string | null;};diff --git a/packages/features/booking-audit/lib/actions/__tests__/NoShowUpdatedAuditActionService.test.ts b/packages/features/booking-audit/lib/actions/__tests__/NoShowUpdatedAuditActionService.test.tsindex 6c1f0010bec..748b7b3c5a1 100644--- a/packages/features/booking-audit/lib/actions/__tests__/NoShowUpdatedAuditActionService.test.ts+++ b/packages/features/booking-audit/lib/actions/__tests__/NoShowUpdatedAuditActionService.test.ts@@ -21,9 +21,9 @@ describe("NoShowUpdatedAuditActionService - getDataRequirements contract", () =>},};- const { errors, accessedData} = await verifyDataRequirementsContract(service, storedData);+ const { errors, accessedData } = await verifyDataRequirementsContract(service, storedData);expect(errors).toEqual([]);- expect(accessedData.userUuids.size).toBe(1)+ expect(accessedData.userUuids.size).toBe(1);});it("should declare empty userUuids when only attendees are set", async () => {@@ -34,9 +34,9 @@ describe("NoShowUpdatedAuditActionService - getDataRequirements contract", () =>},};- const { errors, accessedData} = await verifyDataRequirementsContract(service, storedData);+ const { errors, accessedData } = await verifyDataRequirementsContract(service, storedData);expect(errors).toEqual([]);- expect(accessedData.userUuids.size).toBe(0)+ expect(accessedData.userUuids.size).toBe(0);});it("should declare exactly the userUuids accessed when both host and attendees are set", async () => {diff --git a/packages/features/booking-audit/lib/actions/__tests__/ReassignmentAuditActionService.test.ts b/packages/features/booking-audit/lib/actions/__tests__/ReassignmentAuditActionService.test.tsindex 907c5fbfbd7..13655bcaef1 100644--- a/packages/features/booking-audit/lib/actions/__tests__/ReassignmentAuditActionService.test.ts+++ b/packages/features/booking-audit/lib/actions/__tests__/ReassignmentAuditActionService.test.ts@@ -338,7 +338,13 @@ describe("ReassignmentAuditActionService", () => {const dbStore = createMockEnrichmentDataStore({users: [- { id: 1, uuid: "organizer-old", name: "Previous Host", email: "[email protected]", avatarUrl: null },+ {+ id: 1,+ uuid: "organizer-old",+ name: "Previous Host",+ email: "[email protected]",+ avatarUrl: null,+ },{ id: 2, uuid: "organizer-new", name: "New Host", email: "[email protected]", avatarUrl: null },],},@@ -372,7 +378,13 @@ describe("ReassignmentAuditActionService", () => {const dbStore = createMockEnrichmentDataStore({users: [- { id: 1, uuid: "organizer-old", name: "Previous Host", email: "[email protected]", avatarUrl: null },+ {+ id: 1,+ uuid: "organizer-old",+ name: "Previous Host",+ email: "[email protected]",+ avatarUrl: null,+ },{ id: 2, uuid: "organizer-new", name: "New Host", email: "[email protected]", avatarUrl: null },],},diff --git a/packages/features/booking-audit/lib/actions/__tests__/contractVerification.ts b/packages/features/booking-audit/lib/actions/__tests__/contractVerification.tsindex 4bc5e17dbc5..41d99b76e7a 100644--- a/packages/features/booking-audit/lib/actions/__tests__/contractVerification.ts+++ b/packages/features/booking-audit/lib/actions/__tests__/contractVerification.ts@@ -1,4 +1,10 @@-import type { EnrichmentDataStore, DataRequirements, StoredUser, StoredAttendee, StoredCredential } from "../../service/EnrichmentDataStore";+import type {+ EnrichmentDataStore,+ DataRequirements,+ StoredUser,+ StoredAttendee,+ StoredCredential,+} from "../../service/EnrichmentDataStore";import type { IAuditActionService, BaseStoredAuditData } from "../IAuditActionService";type AccessedData = {@@ -146,7 +152,9 @@ export async function verifyDataRequirementsContract(for (const uuid of accessedData.userUuids) {if (!declaredRequirements.userUuids?.includes(uuid)) {- errors.push(`Under-declaration: getUserByUuid("${uuid}") was called but not declared in getDataRequirements`);+ errors.push(+ `Under-declaration: getUserByUuid("${uuid}") was called but not declared in getDataRequirements`+ );}}@@ -158,7 +166,9 @@ export async function verifyDataRequirementsContract(for (const id of accessedData.attendeeIds) {if (!declaredRequirements.attendeeIds?.includes(id)) {- errors.push(`Under-declaration: getAttendeeById(${id}) was called but not declared in getDataRequirements`);+ errors.push(+ `Under-declaration: getAttendeeById(${id}) was called but not declared in getDataRequirements`+ );}}@@ -170,7 +180,9 @@ export async function verifyDataRequirementsContract(for (const id of accessedData.credentialIds) {if (!declaredRequirements.credentialIds?.includes(id)) {- errors.push(`Under-declaration: getCredentialById(${id}) was called but not declared in getDataRequirements`);+ errors.push(+ `Under-declaration: getCredentialById(${id}) was called but not declared in getDataRequirements`+ );}}diff --git a/packages/features/booking-audit/lib/common/changeSchemas.ts b/packages/features/booking-audit/lib/common/changeSchemas.tsindex 55dece61077..ec1ac3024ef 100644--- a/packages/features/booking-audit/lib/common/changeSchemas.ts+++ b/packages/features/booking-audit/lib/common/changeSchemas.ts@@ -7,27 +7,26 @@ import { BookingStatus } from "@calcom/prisma/enums";*/export const StringChangeSchema = z.object({- old: z.string().nullable(),- new: z.string().nullable(),+ old: z.string().nullable(),+ new: z.string().nullable(),});export const BooleanChangeSchema = z.object({- old: z.boolean().nullable(),- new: z.boolean(),+ old: z.boolean().nullable(),+ new: z.boolean(),});export const StringArrayChangeSchema = z.object({- old: z.array(z.string()).nullable(),- new: z.array(z.string()),+ old: z.array(z.string()).nullable(),+ new: z.array(z.string()),});export const NumberChangeSchema = z.object({- old: z.number().nullable(),- new: z.number(),+ old: z.number().nullable(),+ new: z.number(),});export const BookingStatusChangeSchema = z.object({- old: z.nativeEnum(BookingStatus).nullable(),- new: z.nativeEnum(BookingStatus),+ old: z.nativeEnum(BookingStatus).nullable(),+ new: z.nativeEnum(BookingStatus),});-diff --git a/packages/features/booking-audit/lib/dto/types.ts b/packages/features/booking-audit/lib/dto/types.tsindex 794e57edc5b..58d3bd71c92 100644--- a/packages/features/booking-audit/lib/dto/types.ts+++ b/packages/features/booking-audit/lib/dto/types.ts@@ -1,50 +1,50 @@import { z } from "zod";const UserActorSchema = z.object({- identifiedBy: z.literal("user"),- userUuid: z.string(),+ identifiedBy: z.literal("user"),+ userUuid: z.string(),});const AttendeeActorSchema = z.object({- identifiedBy: z.literal("attendee"),- attendeeId: z.number(),+ identifiedBy: z.literal("attendee"),+ attendeeId: z.number(),});const ActorByIdSchema = z.object({- identifiedBy: z.literal("id"),- id: z.string(),+ identifiedBy: z.literal("id"),+ id: z.string(),});const GuestActorSchema = z.object({- identifiedBy: z.literal("guest"),- email: z.string(),- name: z.string().nullable(),+ identifiedBy: z.literal("guest"),+ email: z.string(),+ name: z.string().nullable(),});const AppActorByCredentialIdSchema = z.object({- identifiedBy: z.literal("app"),- credentialId: z.number(),+ identifiedBy: z.literal("app"),+ credentialId: z.number(),});const AppActorBySlugSchema = z.object({- identifiedBy: z.literal("appSlug"),- appSlug: z.string(),- name: z.string(),+ identifiedBy: z.literal("appSlug"),+ appSlug: z.string(),+ name: z.string(),});export const ActorSchema = z.discriminatedUnion("identifiedBy", [- ActorByIdSchema,- UserActorSchema,- AttendeeActorSchema,- GuestActorSchema,- AppActorByCredentialIdSchema,- AppActorBySlugSchema,+ ActorByIdSchema,+ UserActorSchema,+ AttendeeActorSchema,+ GuestActorSchema,+ AppActorByCredentialIdSchema,+ AppActorBySlugSchema,]);export const PiiFreeActorSchema = z.discriminatedUnion("identifiedBy", [- ActorByIdSchema,- UserActorSchema,- AttendeeActorSchema,+ ActorByIdSchema,+ UserActorSchema,+ AttendeeActorSchema,]);export type Actor = z.infer<typeof ActorSchema>;@@ -63,8 +63,7 @@ export type AppActorBySlug = z.infer<typeof AppActorBySlugSchema>;* This is separate from action-specific data because impersonation is orthogonal to the action type*/export const BookingAuditContextSchema = z.object({- impersonatedBy: z.string().optional(),+ impersonatedBy: z.string().optional(),});export type BookingAuditContext = z.infer<typeof BookingAuditContextSchema>;-diff --git a/packages/features/booking-audit/lib/getAppNameFromSlug.ts b/packages/features/booking-audit/lib/getAppNameFromSlug.tsindex d12efc9a61c..db0d385cff4 100644--- a/packages/features/booking-audit/lib/getAppNameFromSlug.ts+++ b/packages/features/booking-audit/lib/getAppNameFromSlug.ts@@ -3,16 +3,16 @@* Falls back to slug itself if not in map*/const APP_SLUG_TO_NAME: Record<string, string> = {- stripe: "Stripe",- paypal: "Paypal",- alby: "Alby",- hitpay: "HitPay",- btcpayserver: "BTCPayServer",+ stripe: "Stripe",+ paypal: "Paypal",+ alby: "Alby",+ hitpay: "HitPay",+ btcpayserver: "BTCPayServer",};export function getAppNameFromSlug({ appSlug }: { appSlug: string | null }): string {- if (!appSlug) {- return "Unknown App";- }- return APP_SLUG_TO_NAME[appSlug] ?? appSlug;+ if (!appSlug) {+ return "Unknown App";+ }+ return APP_SLUG_TO_NAME[appSlug] ?? appSlug;}diff --git a/packages/features/booking-audit/lib/makeActor.ts b/packages/features/booking-audit/lib/makeActor.tsindex 2c7e53305fa..3d114cfeed7 100644--- a/packages/features/booking-audit/lib/makeActor.ts+++ b/packages/features/booking-audit/lib/makeActor.ts@@ -1,4 +1,11 @@-import type { UserActor, GuestActor, AttendeeActor, ActorById, AppActorByCredentialId, AppActorBySlug } from "./dto/types";+import type {+ UserActor,+ GuestActor,+ AttendeeActor,+ ActorById,+ AppActorByCredentialId,+ AppActorBySlug,+} from "./dto/types";import { v4 as uuidv4 } from "uuid";const SYSTEM_ACTOR_ID = "00000000-0000-0000-0000-000000000000";@@ -7,18 +14,18 @@ const SYSTEM_ACTOR_ID = "00000000-0000-0000-0000-000000000000";* Creates an Actor representing a User by UUID*/export function makeUserActor(userUuid: string): UserActor {- return {- identifiedBy: "user",- userUuid,- };+ return {+ identifiedBy: "user",+ userUuid,+ };}-export function makeGuestActor({ email, name }: { email: string, name: string | null }): GuestActor {- return {- identifiedBy: "guest",- email,- name: name ?? null,- };+export function makeGuestActor({ email, name }: { email: string; name: string | null }): GuestActor {+ return {+ identifiedBy: "guest",+ email,+ name: name ?? null,+ };}/**@@ -26,31 +33,30 @@ export function makeGuestActor({ email, name }: { email: string, name: string |* System actors must be referenced by ID (requires migration)*/export function makeSystemActor(): ActorById {- return {- identifiedBy: "id",- id: SYSTEM_ACTOR_ID,- };+ return {+ identifiedBy: "id",+ id: SYSTEM_ACTOR_ID,+ };}-/*** Creates an Actor by existing actor ID*/export function makeActorById(id: string): ActorById {- return {- identifiedBy: "id",- id,- };+ return {+ identifiedBy: "id",+ id,+ };}/*** Creates an Actor representing an Attendee by attendee ID*/export function makeAttendeeActor(attendeeId: number): AttendeeActor {- return {- identifiedBy: "attendee",- attendeeId,- };+ return {+ identifiedBy: "attendee",+ attendeeId,+ };}/**@@ -59,10 +65,10 @@ export function makeAttendeeActor(attendeeId: number): AttendeeActor {* App name and slug are derived from the credential at display time*/export function makeAppActor(params: { credentialId: number }): AppActorByCredentialId {- return {- identifiedBy: "app",- credentialId: params.credentialId,- };+ return {+ identifiedBy: "app",+ credentialId: params.credentialId,+ };}/**@@ -71,20 +77,26 @@ export function makeAppActor(params: { credentialId: number }): AppActorByCreden* App actors use @app.internal email convention*/export function makeAppActorUsingSlug(params: { appSlug: string; name: string }): AppActorBySlug {- return {- identifiedBy: "appSlug",- appSlug: params.appSlug,- name: params.name,- };+ return {+ identifiedBy: "appSlug",+ appSlug: params.appSlug,+ name: params.name,+ };}/*** identifier should be unique for that actor*/-export function buildActorEmail({ identifier, actorType }: { identifier: string, actorType: "system" | "guest" | "app" }): string {- return `${identifier}@${actorType}.internal`;+export function buildActorEmail({+ identifier,+ actorType,+}: {+ identifier: string;+ actorType: "system" | "guest" | "app";+}): string {+ return `${identifier}@${actorType}.internal`;}export function getUniqueIdentifier({ prefix }: { prefix: string }): string {- return `${prefix}-${uuidv4()}`;-}\ No newline at end of file+ return `${prefix}-${uuidv4()}`;+}diff --git a/packages/features/booking-audit/lib/repository/IAuditActorRepository.ts b/packages/features/booking-audit/lib/repository/IAuditActorRepository.tsindex 76f40b0b2c0..8f081b88e73 100644--- a/packages/features/booking-audit/lib/repository/IAuditActorRepository.ts+++ b/packages/features/booking-audit/lib/repository/IAuditActorRepository.ts@@ -10,15 +10,17 @@ type AuditActor = {phone: string | null;name: string | null;createdAt: Date;-}+};export interface IAuditActorRepository {findByUserUuid(userUuid: string): Promise<AuditActor | null>;createIfNotExistsUserActor(params: { userUuid: string }): Promise<AuditActor>;createIfNotExistsAttendeeActor(params: { attendeeId: number }): Promise<AuditActor>;- createIfNotExistsGuestActor(params: { email: string | null; name: string | null; phone: string | null }): Promise<AuditActor>;- createIfNotExistsAppActor(params:- | { credentialId: number }- | { email: string; name: string }+ createIfNotExistsGuestActor(params: {+ email: string | null;+ name: string | null;+ phone: string | null;+ }): Promise<AuditActor>;+ createIfNotExistsAppActor(+ params: { credentialId: number } | { email: string; name: string }): Promise<AuditActor>;}-diff --git a/packages/features/booking-audit/lib/repository/IBookingAuditRepository.ts b/packages/features/booking-audit/lib/repository/IBookingAuditRepository.tsindex 38767bce36f..a0cc7340547 100644--- a/packages/features/booking-audit/lib/repository/IBookingAuditRepository.ts+++ b/packages/features/booking-audit/lib/repository/IBookingAuditRepository.ts@@ -3,74 +3,89 @@ import type { AuditActorType } from "./IAuditActorRepository";import type { ActionSource } from "../types/actionSource";import type { BookingAuditContext } from "../dto/types";-export type BookingAuditType = "RECORD_CREATED" | "RECORD_UPDATED" | "RECORD_DELETED"+export type BookingAuditType = "RECORD_CREATED" | "RECORD_UPDATED" | "RECORD_DELETED";/*** Booking audit actions track changes to bookings throughout their lifecycle.- *+ ** Note: PENDING and AWAITING_HOST represent initial booking states, not transitions.* They are reserved in the enum for potential future use but should not appear in audit logs.* Use the CREATED action to capture initial booking status instead.*/-export type BookingAuditAction = "CREATED" | "CANCELLED" | "ACCEPTED" | "REJECTED" | "PENDING" | "AWAITING_HOST" | "RESCHEDULED" | "ATTENDEE_ADDED" | "ATTENDEE_REMOVED" | "REASSIGNMENT" | "LOCATION_CHANGED" | "NO_SHOW_UPDATED" | "RESCHEDULE_REQUESTED" | "SEAT_BOOKED" | "SEAT_RESCHEDULED"+export type BookingAuditAction =+ | "CREATED"+ | "CANCELLED"+ | "ACCEPTED"+ | "REJECTED"+ | "PENDING"+ | "AWAITING_HOST"+ | "RESCHEDULED"+ | "ATTENDEE_ADDED"+ | "ATTENDEE_REMOVED"+ | "REASSIGNMENT"+ | "LOCATION_CHANGED"+ | "NO_SHOW_UPDATED"+ | "RESCHEDULE_REQUESTED"+ | "SEAT_BOOKED"+ | "SEAT_RESCHEDULED";export type BookingAuditCreateInput = {- bookingUid: string;- actorId: string;- action: BookingAuditAction;- data: JsonValue;- type: BookingAuditType;- timestamp: Date;- source: ActionSource;- operationId: string;- context?: BookingAuditContext;-}+ bookingUid: string;+ actorId: string;+ action: BookingAuditAction;+ data: JsonValue;+ type: BookingAuditType;+ timestamp: Date;+ source: ActionSource;+ operationId: string;+ context?: BookingAuditContext;+};type BookingAudit = {- id: string;- bookingUid: string;- actorId: string;- action: BookingAuditAction;- type: BookingAuditType;- timestamp: Date;- createdAt: Date;- updatedAt: Date;- data: JsonValue;- source: ActionSource;- operationId: string;-}+ id: string;+ bookingUid: string;+ actorId: string;+ action: BookingAuditAction;+ type: BookingAuditType;+ timestamp: Date;+ createdAt: Date;+ updatedAt: Date;+ data: JsonValue;+ source: ActionSource;+ operationId: string;+};export type BookingAuditWithActor = BookingAudit & {- context: BookingAuditContext | null;- actor: {- id: string;- type: AuditActorType;- userUuid: string | null;- attendeeId: number | null;- credentialId: number | null;- name: string | null;- createdAt: Date;- };-}+ context: BookingAuditContext | null;+ actor: {+ id: string;+ type: AuditActorType;+ userUuid: string | null;+ attendeeId: number | null;+ credentialId: number | null;+ name: string | null;+ createdAt: Date;+ };+};export interface IBookingAuditRepository {- /**- * Creates a new booking audit record- */- create(bookingAudit: BookingAuditCreateInput): Promise<BookingAudit>;+ /**+ * Creates a new booking audit record+ */+ create(bookingAudit: BookingAuditCreateInput): Promise<BookingAudit>;- createMany(bookingAudits: BookingAuditCreateInput[]): Promise<{ count: number }>;+ createMany(bookingAudits: BookingAuditCreateInput[]): Promise<{ count: number }>;- /**- * Retrieves all audit logs for a specific booking- * @param bookingUid - The unique identifier of the booking- * @returns Array of audit logs with actor information, ordered by timestamp DESC- */- findAllForBooking(bookingUid: string): Promise<BookingAuditWithActor[]>;+ /**+ * Retrieves all audit logs for a specific booking+ * @param bookingUid - The unique identifier of the booking+ * @returns Array of audit logs with actor information, ordered by timestamp DESC+ */+ findAllForBooking(bookingUid: string): Promise<BookingAuditWithActor[]>;- /**- * Retrieves all RESCHEDULED audit logs for a specific booking- * @param bookingUid - The unique identifier of the booking- * @returns Array of RESCHEDULED audit logs with actor information, ordered by timestamp DESC- */- findRescheduledLogsOfBooking(bookingUid: string): Promise<BookingAuditWithActor[]>;+ /**+ * Retrieves all RESCHEDULED audit logs for a specific booking+ * @param bookingUid - The unique identifier of the booking+ * @returns Array of RESCHEDULED audit logs with actor information, ordered by timestamp DESC+ */+ findRescheduledLogsOfBooking(bookingUid: string): Promise<BookingAuditWithActor[]>;}diff --git a/packages/features/booking-audit/lib/repository/PrismaAuditActorRepository.ts b/packages/features/booking-audit/lib/repository/PrismaAuditActorRepository.tsindex f3b7fd30623..be4e7fc5bae 100644--- a/packages/features/booking-audit/lib/repository/PrismaAuditActorRepository.ts+++ b/packages/features/booking-audit/lib/repository/PrismaAuditActorRepository.ts@@ -2,128 +2,127 @@ import type { PrismaClient } from "@calcom/prisma/client";import type { IAuditActorRepository } from "./IAuditActorRepository";type Dependencies = {- prismaClient: PrismaClient;-}+ prismaClient: PrismaClient;+};export class PrismaAuditActorRepository implements IAuditActorRepository {- constructor(private readonly deps: Dependencies) { }- async findByUserUuid(userUuid: string) {- return this.deps.prismaClient.auditActor.findUnique({- where: { userUuid },- });- }-- async createIfNotExistsUserActor(params: { userUuid: string }) {- return this.deps.prismaClient.auditActor.upsert({- where: { userUuid: params.userUuid },- create: {- type: "USER",- userUuid: params.userUuid,- },- update: {},- });- }-- async createIfNotExistsGuestActor(params: { email: string | null; name: string | null; phone: string | null }) {- const { email, name, phone } = params;- const normalizedEmail = email && email.trim() !== "" ? email : null;- const normalizedName = name && name.trim() !== "" ? name : null;- const normalizedPhone = phone && phone.trim() !== "" ? phone : null;+ constructor(private readonly deps: Dependencies) {}+ async findByUserUuid(userUuid: string) {+ return this.deps.prismaClient.auditActor.findUnique({+ where: { userUuid },+ });+ }- // If all fields are null, we can't use upsert (no unique constraint), so just create a new record- if (!normalizedEmail && !normalizedPhone) {- return this.deps.prismaClient.auditActor.create({- data: {- type: "GUEST",- email: null,- name: normalizedName,- phone: null,- },- });- }+ async createIfNotExistsUserActor(params: { userUuid: string }) {+ return this.deps.prismaClient.auditActor.upsert({+ where: { userUuid: params.userUuid },+ create: {+ type: "USER",+ userUuid: params.userUuid,+ },+ update: {},+ });+ }- // First try to find by email if email exists- if (normalizedEmail) {- const existingByEmail = await this.deps.prismaClient.auditActor.findUnique({- where: { email: normalizedEmail },- });+ async createIfNotExistsGuestActor(params: {+ email: string | null;+ name: string | null;+ phone: string | null;+ }) {+ const { email, name, phone } = params;+ const normalizedEmail = email && email.trim() !== "" ? email : null;+ const normalizedName = name && name.trim() !== "" ? name : null;+ const normalizedPhone = phone && phone.trim() !== "" ? phone : null;- if (existingByEmail) {- // Update existing record found by email- return this.deps.prismaClient.auditActor.update({- where: { email: normalizedEmail },- data: {- name: normalizedName ?? undefined,- phone: normalizedPhone ?? undefined,- },- });- }- }-- // If not found by email and phone exists, try to find by phone- if (normalizedPhone) {- const existingByPhone = await this.deps.prismaClient.auditActor.findUnique({- where: { phone: normalizedPhone },- });+ // If all fields are null, we can't use upsert (no unique constraint), so just create a new record+ if (!normalizedEmail && !normalizedPhone) {+ return this.deps.prismaClient.auditActor.create({+ data: {+ type: "GUEST",+ email: null,+ name: normalizedName,+ phone: null,+ },+ });+ }- if (existingByPhone) {- // Update existing record found by phone- return this.deps.prismaClient.auditActor.update({- where: { phone: normalizedPhone },- data: {- email: normalizedEmail ?? undefined,- name: normalizedName ?? undefined,- },- });- }- }+ // First try to find by email if email exists+ if (normalizedEmail) {+ const existingByEmail = await this.deps.prismaClient.auditActor.findUnique({+ where: { email: normalizedEmail },+ });- // Not found by either email or phone, create new record- return this.deps.prismaClient.auditActor.create({- data: {- type: "GUEST",- email: normalizedEmail,- name: normalizedName,- phone: normalizedPhone,- },+ if (existingByEmail) {+ // Update existing record found by email+ return this.deps.prismaClient.auditActor.update({+ where: { email: normalizedEmail },+ data: {+ name: normalizedName ?? undefined,+ phone: normalizedPhone ?? undefined,+ },});+ }}- async createIfNotExistsAttendeeActor(params: { attendeeId: number }) {- return this.deps.prismaClient.auditActor.upsert({- where: { attendeeId: params.attendeeId },- create: {- type: "ATTENDEE",- attendeeId: params.attendeeId,- },- update: {},+ // If not found by email and phone exists, try to find by phone+ if (normalizedPhone) {+ const existingByPhone = await this.deps.prismaClient.auditActor.findUnique({+ where: { phone: normalizedPhone },+ });++ if (existingByPhone) {+ // Update existing record found by phone+ return this.deps.prismaClient.auditActor.update({+ where: { phone: normalizedPhone },+ data: {+ email: normalizedEmail ?? undefined,+ name: normalizedName ?? undefined,+ },});+ }}- async createIfNotExistsAppActor(params:- | { credentialId: number }- | { email: string; name: string }- ) {- if ('credentialId' in params) {- return this.deps.prismaClient.auditActor.upsert({- where: { credentialId: params.credentialId },- create: {- type: "APP",- credentialId: params.credentialId,- },- update: {},- });- }+ // Not found by either email or phone, create new record+ return this.deps.prismaClient.auditActor.create({+ data: {+ type: "GUEST",+ email: normalizedEmail,+ name: normalizedName,+ phone: normalizedPhone,+ },+ });+ }- return this.deps.prismaClient.auditActor.upsert({- where: { email: params.email },- create: {- type: "APP",- email: params.email,- name: params.name,- },- update: {},- });+ async createIfNotExistsAttendeeActor(params: { attendeeId: number }) {+ return this.deps.prismaClient.auditActor.upsert({+ where: { attendeeId: params.attendeeId },+ create: {+ type: "ATTENDEE",+ attendeeId: params.attendeeId,+ },+ update: {},+ });+ }++ async createIfNotExistsAppActor(params: { credentialId: number } | { email: string; name: string }) {+ if ("credentialId" in params) {+ return this.deps.prismaClient.auditActor.upsert({+ where: { credentialId: params.credentialId },+ create: {+ type: "APP",+ credentialId: params.credentialId,+ },+ update: {},+ });}+ return this.deps.prismaClient.auditActor.upsert({+ where: { email: params.email },+ create: {+ type: "APP",+ email: params.email,+ name: params.name,+ },+ update: {},+ });+ }}-diff --git a/packages/features/booking-audit/lib/repository/PrismaBookingAuditRepository.ts b/packages/features/booking-audit/lib/repository/PrismaBookingAuditRepository.tsindex f037c756af7..48bd14891e4 100644--- a/packages/features/booking-audit/lib/repository/PrismaBookingAuditRepository.ts+++ b/packages/features/booking-audit/lib/repository/PrismaBookingAuditRepository.ts@@ -1,122 +1,125 @@import type { PrismaClient } from "@calcom/prisma";import type { Prisma } from "@calcom/prisma/client";-import type { IBookingAuditRepository, BookingAuditCreateInput, BookingAuditWithActor } from "./IBookingAuditRepository";+import type {+ IBookingAuditRepository,+ BookingAuditCreateInput,+ BookingAuditWithActor,+} from "./IBookingAuditRepository";import { BookingAuditContextSchema } from "../dto/types";type Dependencies = {- prismaClient: PrismaClient;-}+ prismaClient: PrismaClient;+};/*** Safe actor fields to expose in audit logs* Excludes PII fields like email and phone that aren't needed for display*/const safeActorSelect = {- id: true,- type: true,- userUuid: true,- attendeeId: true,- credentialId: true,- name: true,- createdAt: true,+ id: true,+ type: true,+ userUuid: true,+ attendeeId: true,+ credentialId: true,+ name: true,+ createdAt: true,} as const;const safeBookingAuditSelect = {- id: true,- bookingUid: true,- actorId: true,- action: true,- type: true,- timestamp: true,- source: true,- operationId: true,- data: true,- context: true,- createdAt: true,- updatedAt: true,+ id: true,+ bookingUid: true,+ actorId: true,+ action: true,+ type: true,+ timestamp: true,+ source: true,+ operationId: true,+ data: true,+ context: true,+ createdAt: true,+ updatedAt: true,} as const;export class PrismaBookingAuditRepository implements IBookingAuditRepository {- constructor(private readonly deps: Dependencies) { }+ constructor(private readonly deps: Dependencies) {}- private parsed<T extends { context: Prisma.JsonValue }>(auditLog: T) {- return {- ...auditLog,- context: auditLog.context ? BookingAuditContextSchema.parse(auditLog.context) : null,- };- }+ private parsed<T extends { context: Prisma.JsonValue }>(auditLog: T) {+ return {+ ...auditLog,+ context: auditLog.context ? BookingAuditContextSchema.parse(auditLog.context) : null,+ };+ }- async create(bookingAudit: BookingAuditCreateInput) {- const created = await this.deps.prismaClient.bookingAudit.create({- data: {- bookingUid: bookingAudit.bookingUid,- actorId: bookingAudit.actorId,- action: bookingAudit.action,- type: bookingAudit.type,- timestamp: bookingAudit.timestamp,- source: bookingAudit.source,- operationId: bookingAudit.operationId,- data: bookingAudit.data === null ? undefined : bookingAudit.data,- context: bookingAudit.context ?? undefined,- },- });+ async create(bookingAudit: BookingAuditCreateInput) {+ const created = await this.deps.prismaClient.bookingAudit.create({+ data: {+ bookingUid: bookingAudit.bookingUid,+ actorId: bookingAudit.actorId,+ action: bookingAudit.action,+ type: bookingAudit.type,+ timestamp: bookingAudit.timestamp,+ source: bookingAudit.source,+ operationId: bookingAudit.operationId,+ data: bookingAudit.data === null ? undefined : bookingAudit.data,+ context: bookingAudit.context ?? undefined,+ },+ });- return this.parsed(created);- }+ return this.parsed(created);+ }- async createMany(bookingAudits: BookingAuditCreateInput[]) {- const result = await this.deps.prismaClient.bookingAudit.createMany({- data: bookingAudits.map((bookingAudit) => ({- bookingUid: bookingAudit.bookingUid,- actorId: bookingAudit.actorId,- action: bookingAudit.action,- type: bookingAudit.type,- timestamp: bookingAudit.timestamp,- source: bookingAudit.source,- operationId: bookingAudit.operationId,- data: bookingAudit.data === null ? undefined : bookingAudit.data,- context: bookingAudit.context === undefined ? undefined : bookingAudit.context,- })),- });- return { count: result.count };- }+ async createMany(bookingAudits: BookingAuditCreateInput[]) {+ const result = await this.deps.prismaClient.bookingAudit.createMany({+ data: bookingAudits.map((bookingAudit) => ({+ bookingUid: bookingAudit.bookingUid,+ actorId: bookingAudit.actorId,+ action: bookingAudit.action,+ type: bookingAudit.type,+ timestamp: bookingAudit.timestamp,+ source: bookingAudit.source,+ operationId: bookingAudit.operationId,+ data: bookingAudit.data === null ? undefined : bookingAudit.data,+ context: bookingAudit.context === undefined ? undefined : bookingAudit.context,+ })),+ });+ return { count: result.count };+ }- async findAllForBooking(bookingUid: string): Promise<BookingAuditWithActor[]> {- const results = await this.deps.prismaClient.bookingAudit.findMany({- where: {- bookingUid,- },- select: {- ...safeBookingAuditSelect,- actor: {- select: safeActorSelect,- },- },- orderBy: {- timestamp: "desc",- },- });+ async findAllForBooking(bookingUid: string): Promise<BookingAuditWithActor[]> {+ const results = await this.deps.prismaClient.bookingAudit.findMany({+ where: {+ bookingUid,+ },+ select: {+ ...safeBookingAuditSelect,+ actor: {+ select: safeActorSelect,+ },+ },+ orderBy: {+ timestamp: "desc",+ },+ });- return results.map(this.parsed);- }+ return results.map(this.parsed);+ }- async findRescheduledLogsOfBooking(bookingUid: string): Promise<BookingAuditWithActor[]> {- const results = await this.deps.prismaClient.bookingAudit.findMany({- where: {- bookingUid,- action: "RESCHEDULED",- },- select: {- ...safeBookingAuditSelect,- actor: {- select: safeActorSelect- },- },- orderBy: { timestamp: "desc" },- });+ async findRescheduledLogsOfBooking(bookingUid: string): Promise<BookingAuditWithActor[]> {+ const results = await this.deps.prismaClient.bookingAudit.findMany({+ where: {+ bookingUid,+ action: "RESCHEDULED",+ },+ select: {+ ...safeBookingAuditSelect,+ actor: {+ select: safeActorSelect,+ },+ },+ orderBy: { timestamp: "desc" },+ });- return results.map(this.parsed);- }+ return results.map(this.parsed);+ }}-diff --git a/packages/features/booking-audit/lib/service/ActorStrategies.ts b/packages/features/booking-audit/lib/service/ActorStrategies.tsindex c2b7a00092b..08fa6c20dc6 100644--- a/packages/features/booking-audit/lib/service/ActorStrategies.ts+++ b/packages/features/booking-audit/lib/service/ActorStrategies.ts@@ -64,7 +64,9 @@ export const ACTOR_STRATEGIES: Record<AuditActorType, ActorStrategy> = {enrich: (actor, dbStore) => {const credential = actor.credentialId ? dbStore.getCredentialById(actor.credentialId) : null;return {- displayName: credential ? getAppNameFromSlug({ appSlug: credential.appId }) : (actor.name ?? "Deleted App"),+ displayName: credential+ ? getAppNameFromSlug({ appSlug: credential.appId })+ : (actor.name ?? "Deleted App"),displayEmail: null,displayAvatar: null,};diff --git a/packages/features/booking-audit/lib/service/BookingAuditAccessService.ts b/packages/features/booking-audit/lib/service/BookingAuditAccessService.tsindex c5c05af498a..e8bc54e3d72 100644--- a/packages/features/booking-audit/lib/service/BookingAuditAccessService.ts+++ b/packages/features/booking-audit/lib/service/BookingAuditAccessService.ts@@ -4,23 +4,23 @@ import { PermissionCheckService } from "@calcom/features/pbac/services/permissioimport { MembershipRole } from "@calcom/prisma/enums";export enum BookingAuditErrorCode {- ORGANIZATION_ID_REQUIRED = "ORGANIZATION_ID_REQUIRED",- BOOKING_NOT_FOUND_OR_PERMISSION_DENIED = "BOOKING_NOT_FOUND_OR_PERMISSION_DENIED",- BOOKING_HAS_NO_OWNER = "BOOKING_HAS_NO_OWNER",- OWNER_NOT_IN_ORGANIZATION = "OWNER_NOT_IN_ORGANIZATION",- PERMISSION_DENIED = "PERMISSION_DENIED",+ ORGANIZATION_ID_REQUIRED = "ORGANIZATION_ID_REQUIRED",+ BOOKING_NOT_FOUND_OR_PERMISSION_DENIED = "BOOKING_NOT_FOUND_OR_PERMISSION_DENIED",+ BOOKING_HAS_NO_OWNER = "BOOKING_HAS_NO_OWNER",+ OWNER_NOT_IN_ORGANIZATION = "OWNER_NOT_IN_ORGANIZATION",+ PERMISSION_DENIED = "PERMISSION_DENIED",}export class BookingAuditPermissionError extends Error {- constructor(public readonly code: BookingAuditErrorCode) {- super(code);- this.name = "BookingAuditPermissionError";- }+ constructor(public readonly code: BookingAuditErrorCode) {+ super(code);+ this.name = "BookingAuditPermissionError";+ }}interface BookingAuditAccessServiceDeps {- bookingRepository: BookingRepository;- membershipRepository: MembershipRepository;+ bookingRepository: BookingRepository;+ membershipRepository: MembershipRepository;}/**@@ -29,67 +29,78 @@ interface BookingAuditAccessServiceDeps {* Regular users (including booking organizers and hosts) cannot view audit logs.*/export class BookingAuditAccessService {- private readonly bookingRepository: BookingRepository;- private readonly membershipRepository: MembershipRepository;- private readonly permissionCheckService: PermissionCheckService;+ private readonly bookingRepository: BookingRepository;+ private readonly membershipRepository: MembershipRepository;+ private readonly permissionCheckService: PermissionCheckService;- constructor(deps: BookingAuditAccessServiceDeps) {- this.bookingRepository = deps.bookingRepository;- this.membershipRepository = deps.membershipRepository;- this.permissionCheckService = new PermissionCheckService();- }+ constructor(deps: BookingAuditAccessServiceDeps) {+ this.bookingRepository = deps.bookingRepository;+ this.membershipRepository = deps.membershipRepository;+ this.permissionCheckService = new PermissionCheckService();+ }- /**- * Check if user has permission to view audit logs for a booking- * Throws BookingAuditPermissionError if access is denied- */- async assertPermissions({ bookingUid, userId, organizationId }: { bookingUid: string, userId: number, organizationId: number | null }): Promise<void> {- if (!organizationId) {- throw new BookingAuditPermissionError(BookingAuditErrorCode.ORGANIZATION_ID_REQUIRED);- }+ /**+ * Check if user has permission to view audit logs for a booking+ * Throws BookingAuditPermissionError if access is denied+ */+ async assertPermissions({+ bookingUid,+ userId,+ organizationId,+ }: {+ bookingUid: string;+ userId: number;+ organizationId: number | null;+ }): Promise<void> {+ if (!organizationId) {+ throw new BookingAuditPermissionError(BookingAuditErrorCode.ORGANIZATION_ID_REQUIRED);+ }- const booking = await this.bookingRepository.findByUidIncludeEventType({ bookingUid });- if (!booking) {- throw new BookingAuditPermissionError(BookingAuditErrorCode.BOOKING_NOT_FOUND_OR_PERMISSION_DENIED);- }+ const booking = await this.bookingRepository.findByUidIncludeEventType({ bookingUid });+ if (!booking) {+ throw new BookingAuditPermissionError(BookingAuditErrorCode.BOOKING_NOT_FOUND_OR_PERMISSION_DENIED);+ }- const bookingEventType = booking.eventType;- const bookingEventTypeTeamId = bookingEventType?.teamId ?? bookingEventType?.parent?.teamId;+ const bookingEventType = booking.eventType;+ const bookingEventTypeTeamId = bookingEventType?.teamId ?? bookingEventType?.parent?.teamId;- if (bookingEventTypeTeamId) {- const hasAccess = await this.permissionCheckService.checkPermission({- userId,- teamId: bookingEventTypeTeamId,- permission: "booking.readTeamAuditLogs",- fallbackRoles: [MembershipRole.OWNER, MembershipRole.ADMIN],- });- if (hasAccess) {- return;- }- }+ if (bookingEventTypeTeamId) {+ const hasAccess = await this.permissionCheckService.checkPermission({+ userId,+ teamId: bookingEventTypeTeamId,+ permission: "booking.readTeamAuditLogs",+ fallbackRoles: [MembershipRole.OWNER, MembershipRole.ADMIN],+ });+ if (hasAccess) {+ return;+ }+ }- const bookingOwnerId = booking.userId;+ const bookingOwnerId = booking.userId;- if (!bookingOwnerId) {- throw new BookingAuditPermissionError(BookingAuditErrorCode.BOOKING_HAS_NO_OWNER);- }+ if (!bookingOwnerId) {+ throw new BookingAuditPermissionError(BookingAuditErrorCode.BOOKING_HAS_NO_OWNER);+ }- const isBookingOwnerMemberOfOrganization = await this.membershipRepository.hasMembership({ userId: bookingOwnerId, teamId: organizationId });+ const isBookingOwnerMemberOfOrganization = await this.membershipRepository.hasMembership({+ userId: bookingOwnerId,+ teamId: organizationId,+ });- if (!isBookingOwnerMemberOfOrganization) {- throw new BookingAuditPermissionError(BookingAuditErrorCode.OWNER_NOT_IN_ORGANIZATION);- }+ if (!isBookingOwnerMemberOfOrganization) {+ throw new BookingAuditPermissionError(BookingAuditErrorCode.OWNER_NOT_IN_ORGANIZATION);+ }- const hasAccess = await this.permissionCheckService.checkPermission({- userId,- teamId: organizationId,- permission: "booking.readOrgAuditLogs",- fallbackRoles: [MembershipRole.OWNER, MembershipRole.ADMIN],- });+ const hasAccess = await this.permissionCheckService.checkPermission({+ userId,+ teamId: organizationId,+ permission: "booking.readOrgAuditLogs",+ fallbackRoles: [MembershipRole.OWNER, MembershipRole.ADMIN],+ });- if (hasAccess) {- return;- }- throw new BookingAuditPermissionError(BookingAuditErrorCode.PERMISSION_DENIED);+ if (hasAccess) {+ return;}+ throw new BookingAuditPermissionError(BookingAuditErrorCode.PERMISSION_DENIED);+ }}diff --git a/packages/features/booking-audit/lib/service/BookingAuditActionServiceRegistry.ts b/packages/features/booking-audit/lib/service/BookingAuditActionServiceRegistry.tsindex 0048438f52d..6a8e0ba0b13 100644--- a/packages/features/booking-audit/lib/service/BookingAuditActionServiceRegistry.ts+++ b/packages/features/booking-audit/lib/service/BookingAuditActionServiceRegistry.ts@@ -3,78 +3,105 @@ import type { BookingAuditAction } from "../repository/IBookingAuditRepository";import { CreatedAuditActionService, type CreatedAuditData } from "../actions/CreatedAuditActionService";import { CancelledAuditActionService, type CancelledAuditData } from "../actions/CancelledAuditActionService";-import { RescheduledAuditActionService, type RescheduledAuditData } from "../actions/RescheduledAuditActionService";+import {+ RescheduledAuditActionService,+ type RescheduledAuditData,+} from "../actions/RescheduledAuditActionService";import { AcceptedAuditActionService, type AcceptedAuditData } from "../actions/AcceptedAuditActionService";-import { RescheduleRequestedAuditActionService, type RescheduleRequestedAuditData } from "../actions/RescheduleRequestedAuditActionService";-import { AttendeeAddedAuditActionService, type AttendeeAddedAuditData } from "../actions/AttendeeAddedAuditActionService";-import { NoShowUpdatedAuditActionService, type NoShowUpdatedAuditData } from "../actions/NoShowUpdatedAuditActionService";+import {+ RescheduleRequestedAuditActionService,+ type RescheduleRequestedAuditData,+} from "../actions/RescheduleRequestedAuditActionService";+import {+ AttendeeAddedAuditActionService,+ type AttendeeAddedAuditData,+} from "../actions/AttendeeAddedAuditActionService";+import {+ NoShowUpdatedAuditActionService,+ type NoShowUpdatedAuditData,+} from "../actions/NoShowUpdatedAuditActionService";import { RejectedAuditActionService, type RejectedAuditData } from "../actions/RejectedAuditActionService";-import { AttendeeRemovedAuditActionService, type AttendeeRemovedAuditData } from "../actions/AttendeeRemovedAuditActionService";-import { ReassignmentAuditActionService, type ReassignmentAuditData } from "../actions/ReassignmentAuditActionService";-import { LocationChangedAuditActionService, type LocationChangedAuditData } from "../actions/LocationChangedAuditActionService";-import { SeatBookedAuditActionService, type SeatBookedAuditData } from "../actions/SeatBookedAuditActionService";-import { SeatRescheduledAuditActionService, type SeatRescheduledAuditData } from "../actions/SeatRescheduledAuditActionService";+import {+ AttendeeRemovedAuditActionService,+ type AttendeeRemovedAuditData,+} from "../actions/AttendeeRemovedAuditActionService";+import {+ ReassignmentAuditActionService,+ type ReassignmentAuditData,+} from "../actions/ReassignmentAuditActionService";+import {+ LocationChangedAuditActionService,+ type LocationChangedAuditData,+} from "../actions/LocationChangedAuditActionService";+import {+ SeatBookedAuditActionService,+ type SeatBookedAuditData,+} from "../actions/SeatBookedAuditActionService";+import {+ SeatRescheduledAuditActionService,+ type SeatRescheduledAuditData,+} from "../actions/SeatRescheduledAuditActionService";/*** Union type for all audit action data types* Used for type-safe handling of action-specific data*/export type AuditActionData =- | CreatedAuditData- | CancelledAuditData- | RescheduledAuditData- | AcceptedAuditData- | RescheduleRequestedAuditData- | AttendeeAddedAuditData- | NoShowUpdatedAuditData- | RejectedAuditData- | AttendeeRemovedAuditData- | ReassignmentAuditData- | LocationChangedAuditData- | SeatBookedAuditData- | SeatRescheduledAuditData;+ | CreatedAuditData+ | CancelledAuditData+ | RescheduledAuditData+ | AcceptedAuditData+ | RescheduleRequestedAuditData+ | AttendeeAddedAuditData+ | NoShowUpdatedAuditData+ | RejectedAuditData+ | AttendeeRemovedAuditData+ | ReassignmentAuditData+ | LocationChangedAuditData+ | SeatBookedAuditData+ | SeatRescheduledAuditData;/*** BookingAuditActionServiceRegistry- *+ ** Centralized registry for all booking audit action services.* Provides a single source of truth for action service mapping and eliminates* code duplication between consumer and viewer services.*/export class BookingAuditActionServiceRegistry {- private readonly actionServices: Map<BookingAuditAction, IAuditActionService>;+ private readonly actionServices: Map<BookingAuditAction, IAuditActionService>;- constructor() {- const services: Array<[BookingAuditAction, IAuditActionService]> = [- ["CREATED", new CreatedAuditActionService()],- ["CANCELLED", new CancelledAuditActionService()],- ["RESCHEDULED", new RescheduledAuditActionService()],- ["ACCEPTED", new AcceptedAuditActionService()],- ["RESCHEDULE_REQUESTED", new RescheduleRequestedAuditActionService()],- ["ATTENDEE_ADDED", new AttendeeAddedAuditActionService()],- ["NO_SHOW_UPDATED", new NoShowUpdatedAuditActionService()],- ["REJECTED", new RejectedAuditActionService()],- ["ATTENDEE_REMOVED", new AttendeeRemovedAuditActionService()],- ["REASSIGNMENT", new ReassignmentAuditActionService()],- ["LOCATION_CHANGED", new LocationChangedAuditActionService()],- ["SEAT_BOOKED", new SeatBookedAuditActionService()],- ["SEAT_RESCHEDULED", new SeatRescheduledAuditActionService()],- ];- this.actionServices = new Map(services);- }+ constructor() {+ const services: Array<[BookingAuditAction, IAuditActionService]> = [+ ["CREATED", new CreatedAuditActionService()],+ ["CANCELLED", new CancelledAuditActionService()],+ ["RESCHEDULED", new RescheduledAuditActionService()],+ ["ACCEPTED", new AcceptedAuditActionService()],+ ["RESCHEDULE_REQUESTED", new RescheduleRequestedAuditActionService()],+ ["ATTENDEE_ADDED", new AttendeeAddedAuditActionService()],+ ["NO_SHOW_UPDATED", new NoShowUpdatedAuditActionService()],+ ["REJECTED", new RejectedAuditActionService()],+ ["ATTENDEE_REMOVED", new AttendeeRemovedAuditActionService()],+ ["REASSIGNMENT", new ReassignmentAuditActionService()],+ ["LOCATION_CHANGED", new LocationChangedAuditActionService()],+ ["SEAT_BOOKED", new SeatBookedAuditActionService()],+ ["SEAT_RESCHEDULED", new SeatRescheduledAuditActionService()],+ ];+ this.actionServices = new Map(services);+ }- /**- * Get Action Service - Returns the appropriate action service for the given action type- *- * @param action - The booking audit action type- * @returns The corresponding action service instance with proper typing- * @throws Error if no service is found for the action- */- getActionService(action: BookingAuditAction): IAuditActionService {- const service = this.actionServices.get(action);- if (!service) {- throw new Error(`No action service found for: ${action}`);- }- return service;+ /**+ * Get Action Service - Returns the appropriate action service for the given action type+ *+ * @param action - The booking audit action type+ * @returns The corresponding action service instance with proper typing+ * @throws Error if no service is found for the action+ */+ getActionService(action: BookingAuditAction): IAuditActionService {+ const service = this.actionServices.get(action);+ if (!service) {+ throw new Error(`No action service found for: ${action}`);}+ return service;+ }}diff --git a/packages/features/booking-audit/lib/service/BookingAuditTaskerProducerService.ts b/packages/features/booking-audit/lib/service/BookingAuditTaskerProducerService.tsindex 669c362dac8..54d29b5bb82 100644--- a/packages/features/booking-audit/lib/service/BookingAuditTaskerProducerService.ts+++ b/packages/features/booking-audit/lib/service/BookingAuditTaskerProducerService.ts@@ -25,460 +25,459 @@ import { SeatRescheduledAuditActionService } from "../actions/SeatRescheduledAudimport type { BookingAuditProducerService } from "./BookingAuditProducerService.interface";interface BookingAuditTaskerProducerServiceDeps {- tasker: Tasker;- log: ISimpleLogger;- auditActorRepository: IAuditActorRepository;+ tasker: Tasker;+ log: ISimpleLogger;+ auditActorRepository: IAuditActorRepository;}/*** BookingAuditTaskerProducerService - Tasker-based implementation of BookingAuditProducerService- *+ ** Producer that uses Tasker for local/background job processing.* Task processing is handled by BookingAuditTaskConsumer.- *+ ** For future migration to trigger.dev, create BookingAuditTriggerProducerService* that implements the same BookingAuditProducerService interface.*/export class BookingAuditTaskerProducerService implements BookingAuditProducerService {- private readonly tasker: Tasker;- private readonly log: BookingAuditTaskerProducerServiceDeps["log"];- private readonly auditActorRepository: IAuditActorRepository;-- constructor(private readonly deps: BookingAuditTaskerProducerServiceDeps) {- this.tasker = deps.tasker;- this.log = deps.log;- this.auditActorRepository = deps.auditActorRepository;- }-- private async getPIIFreeBookingAuditActor(params: {- actor: Actor;- }): Promise<PiiFreeActor> {- const { actor } = params;-- if (actor.identifiedBy === "user" || actor.identifiedBy === "attendee" || actor.identifiedBy === "id") {- return actor;- }-- if (actor.identifiedBy === "app") {- const piiFreeActor = await this.auditActorRepository.createIfNotExistsAppActor({- credentialId: actor.credentialId,- });- return makeActorById(piiFreeActor.id);- }-- if (actor.identifiedBy === "appSlug") {- const email = buildActorEmail({ identifier: actor.appSlug, actorType: "app" });- const piiFreeActor = await this.auditActorRepository.createIfNotExistsAppActor({- email,- name: actor.name,- });- return makeActorById(piiFreeActor.id);- }-- // Must be guest actor at this point- const piiFreeActor = await this.auditActorRepository.createIfNotExistsGuestActor({- email: actor.email,- name: actor.name ?? null,- phone: null,- });- return makeActorById(piiFreeActor.id);- }-- /**- * Internal helper to queue audit task to Tasker- * @param params.action - Must be a valid BookingAuditAction value (TYPE from action services are string-typed)- * @param params.operationId - Optional operation ID for correlating bulk operations. If null, will be auto-generated.- * @param params.isBookingAuditEnabled - Flag indicating if booking audit is enabled for the organization.- * When false, skips queueing.- */- private async queueTask(params: {- bookingUid: string;- actor: Actor;- organizationId: number | null;- action: string;- source: ActionSource;- operationId?: string | null;- data: unknown;- context?: BookingAuditContext;- isBookingAuditEnabled: boolean;- }): Promise<void> {- // Skip queueing for non-organization bookings- if (params.organizationId === null) {- return;- }- // Skip queueing if booking audit is disabled for this organization- if (!params.isBookingAuditEnabled) {- this.log.debug(- `Skipping ${params.action} audit: booking-audit feature is disabled for organization`,- { organizationId: params.organizationId, bookingUid: params.bookingUid, action: params.action }- );- return;- }- try {- const piiFreeActor = await this.getPIIFreeBookingAuditActor({- actor: params.actor,- });-- const operationId = params.operationId ?? uuidv4();-- await this.tasker.create("bookingAudit", {- isBulk: false,- bookingUid: params.bookingUid,- actor: piiFreeActor,- organizationId: params.organizationId,- timestamp: Date.now(),- action: params.action as BookingAuditAction,- source: params.source,- operationId,- data: params.data,- context: params.context,- });- } catch (error) {- this.log.error(`Error while queueing ${params.action} audit`, safeStringify(error));- }- }-- async queueCreatedAudit(params: {- bookingUid: string;- actor: Actor;- organizationId: number | null;- source: ActionSource;- operationId?: string | null;- data: z.infer<typeof CreatedAuditActionService.latestFieldsSchema>;- context?: BookingAuditContext;- isBookingAuditEnabled: boolean;- }): Promise<void> {- await this.queueTask({- ...params,- action: CreatedAuditActionService.TYPE,- });- }-- async queueRescheduledAudit(params: {- bookingUid: string;- actor: Actor;- organizationId: number | null;- source: ActionSource;- operationId?: string | null;- data: z.infer<typeof RescheduledAuditActionService.latestFieldsSchema>;- context?: BookingAuditContext;- isBookingAuditEnabled: boolean;- }): Promise<void> {- await this.queueTask({- ...params,- action: RescheduledAuditActionService.TYPE,- });- }-- async queueAcceptedAudit(params: {- bookingUid: string;- actor: Actor;- organizationId: number | null;- source: ActionSource;- operationId?: string | null;- data: z.infer<typeof AcceptedAuditActionService.latestFieldsSchema>;- context?: BookingAuditContext;- isBookingAuditEnabled: boolean;- }): Promise<void> {- await this.queueTask({- ...params,- action: AcceptedAuditActionService.TYPE,- });- }-- async queueCancelledAudit(params: {- bookingUid: string;- actor: Actor;- organizationId: number | null;- source: ActionSource;- operationId?: string | null;- data: z.infer<typeof CancelledAuditActionService.latestFieldsSchema>;- context?: BookingAuditContext;- isBookingAuditEnabled: boolean;- }): Promise<void> {- await this.queueTask({- ...params,- action: CancelledAuditActionService.TYPE,- });- }-- async queueRescheduleRequestedAudit(params: {- bookingUid: string;- actor: Actor;- organizationId: number | null;- source: ActionSource;- operationId?: string | null;- data: z.infer<typeof RescheduleRequestedAuditActionService.latestFieldsSchema>;- context?: BookingAuditContext;- isBookingAuditEnabled: boolean;- }): Promise<void> {- await this.queueTask({- ...params,- action: RescheduleRequestedAuditActionService.TYPE,- });- }-- async queueAttendeeAddedAudit(params: {- bookingUid: string;- actor: Actor;- organizationId: number | null;- source: ActionSource;- operationId?: string | null;- data: z.infer<typeof AttendeeAddedAuditActionService.latestFieldsSchema>;- context?: BookingAuditContext;- isBookingAuditEnabled: boolean;- }): Promise<void> {- await this.queueTask({- ...params,- action: AttendeeAddedAuditActionService.TYPE,- });- }-- async queueNoShowUpdatedAudit(params: {- bookingUid: string;- actor: Actor;- organizationId: number | null;- source: ActionSource;- operationId?: string | null;- data: z.infer<typeof NoShowUpdatedAuditActionService.latestFieldsSchema>;- context?: BookingAuditContext;- isBookingAuditEnabled: boolean;- }): Promise<void> {- await this.queueTask({- ...params,- action: NoShowUpdatedAuditActionService.TYPE,- });- }-- async queueRejectedAudit(params: {- bookingUid: string;- actor: Actor;- organizationId: number | null;- source: ActionSource;- operationId?: string | null;- data: z.infer<typeof RejectedAuditActionService.latestFieldsSchema>;- context?: BookingAuditContext;- isBookingAuditEnabled: boolean;- }): Promise<void> {- await this.queueTask({- ...params,- action: RejectedAuditActionService.TYPE,- });- }+ private readonly tasker: Tasker;+ private readonly log: BookingAuditTaskerProducerServiceDeps["log"];+ private readonly auditActorRepository: IAuditActorRepository;- async queueAttendeeRemovedAudit(params: {- bookingUid: string;- actor: Actor;- organizationId: number | null;- source: ActionSource;- operationId?: string | null;- data: z.infer<typeof AttendeeRemovedAuditActionService.latestFieldsSchema>;- context?: BookingAuditContext;- isBookingAuditEnabled: boolean;- }): Promise<void> {- await this.queueTask({- ...params,- action: AttendeeRemovedAuditActionService.TYPE,- });- }+ constructor(private readonly deps: BookingAuditTaskerProducerServiceDeps) {+ this.tasker = deps.tasker;+ this.log = deps.log;+ this.auditActorRepository = deps.auditActorRepository;+ }- async queueReassignmentAudit(params: {- bookingUid: string;- actor: Actor;- organizationId: number | null;- source: ActionSource;- operationId?: string | null;- data: z.infer<typeof ReassignmentAuditActionService.latestFieldsSchema>;- context?: BookingAuditContext;- isBookingAuditEnabled: boolean;- }): Promise<void> {- await this.queueTask({- ...params,- action: ReassignmentAuditActionService.TYPE,- });- }+ private async getPIIFreeBookingAuditActor(params: { actor: Actor }): Promise<PiiFreeActor> {+ const { actor } = params;- async queueLocationChangedAudit(params: {- bookingUid: string;- actor: Actor;- organizationId: number | null;- source: ActionSource;- operationId?: string | null;- data: z.infer<typeof LocationChangedAuditActionService.latestFieldsSchema>;- context?: BookingAuditContext;- isBookingAuditEnabled: boolean;- }): Promise<void> {- await this.queueTask({- ...params,- action: LocationChangedAuditActionService.TYPE,- });+ if (actor.identifiedBy === "user" || actor.identifiedBy === "attendee" || actor.identifiedBy === "id") {+ return actor;}- async queueSeatBookedAudit(params: {- bookingUid: string;- actor: Actor;- organizationId: number | null;- source: ActionSource;- operationId?: string | null;- data: z.infer<typeof SeatBookedAuditActionService.latestFieldsSchema>;- context?: BookingAuditContext;- isBookingAuditEnabled: boolean;- }): Promise<void> {- await this.queueTask({- ...params,- action: SeatBookedAuditActionService.TYPE,- });+ if (actor.identifiedBy === "app") {+ const piiFreeActor = await this.auditActorRepository.createIfNotExistsAppActor({+ credentialId: actor.credentialId,+ });+ return makeActorById(piiFreeActor.id);}- async queueSeatRescheduledAudit(params: {- bookingUid: string;- actor: Actor;- organizationId: number | null;- source: ActionSource;- operationId?: string | null;- data: z.infer<typeof SeatRescheduledAuditActionService.latestFieldsSchema>;- context?: BookingAuditContext;- isBookingAuditEnabled: boolean;- }): Promise<void> {- await this.queueTask({- ...params,- action: SeatRescheduledAuditActionService.TYPE,- });+ if (actor.identifiedBy === "appSlug") {+ const email = buildActorEmail({ identifier: actor.appSlug, actorType: "app" });+ const piiFreeActor = await this.auditActorRepository.createIfNotExistsAppActor({+ email,+ name: actor.name,+ });+ return makeActorById(piiFreeActor.id);}- private async queueBulkTask(params: {- bookings: Array<{- bookingUid: string;- data: unknown;- }>;- actor: Actor;- organizationId: number | null;- action: string;- source: ActionSource;- operationId?: string | null;- context?: BookingAuditContext;- isBookingAuditEnabled: boolean;- }): Promise<void> {- // Skip queueing for non-organization bookings- if (params.organizationId === null) {- return;- }- // Skip queueing if booking audit is disabled for this organization- if (!params.isBookingAuditEnabled) {- this.log.debug(- `Skipping bulk ${params.action} audit: booking-audit feature is disabled for organization`,- { organizationId: params.organizationId, bookingCount: params.bookings.length, action: params.action }- );- return;- }- try {- const piiFreeActor = await this.getPIIFreeBookingAuditActor({- actor: params.actor,- });-- const operationId = params.operationId ?? uuidv4();-- await this.tasker.create("bookingAudit", {- isBulk: true,- bookings: params.bookings,- actor: piiFreeActor,- organizationId: params.organizationId,- timestamp: Date.now(),- action: params.action as BookingAuditAction,- source: params.source,- operationId,- context: params.context,- });- } catch (error) {- this.log.error(`Error while queueing bulk ${params.action} audit`, safeStringify(error));- }+ // Must be guest actor at this point+ const piiFreeActor = await this.auditActorRepository.createIfNotExistsGuestActor({+ email: actor.email,+ name: actor.name ?? null,+ phone: null,+ });+ return makeActorById(piiFreeActor.id);+ }++ /**+ * Internal helper to queue audit task to Tasker+ * @param params.action - Must be a valid BookingAuditAction value (TYPE from action services are string-typed)+ * @param params.operationId - Optional operation ID for correlating bulk operations. If null, will be auto-generated.+ * @param params.isBookingAuditEnabled - Flag indicating if booking audit is enabled for the organization.+ * When false, skips queueing.+ */+ private async queueTask(params: {+ bookingUid: string;+ actor: Actor;+ organizationId: number | null;+ action: string;+ source: ActionSource;+ operationId?: string | null;+ data: unknown;+ context?: BookingAuditContext;+ isBookingAuditEnabled: boolean;+ }): Promise<void> {+ // Skip queueing for non-organization bookings+ if (params.organizationId === null) {+ return;}-- async queueBulkAcceptedAudit(params: {- bookings: Array<{- bookingUid: string;- data: z.infer<typeof AcceptedAuditActionService.latestFieldsSchema>;- }>;- actor: Actor;- organizationId: number | null;- source: ActionSource;- operationId?: string | null;- context?: BookingAuditContext;- isBookingAuditEnabled: boolean;- }): Promise<void> {- await this.queueBulkTask({- ...params,- action: AcceptedAuditActionService.TYPE,- });+ // Skip queueing if booking audit is disabled for this organization+ if (!params.isBookingAuditEnabled) {+ this.log.debug(`Skipping ${params.action} audit: booking-audit feature is disabled for organization`, {+ organizationId: params.organizationId,+ bookingUid: params.bookingUid,+ action: params.action,+ });+ return;}-- async queueBulkCancelledAudit(params: {- bookings: Array<{- bookingUid: string;- data: z.infer<typeof CancelledAuditActionService.latestFieldsSchema>;- }>;- actor: Actor;- organizationId: number | null;- source: ActionSource;- operationId?: string | null;- context?: BookingAuditContext;- isBookingAuditEnabled: boolean;- }): Promise<void> {- await this.queueBulkTask({- ...params,- action: CancelledAuditActionService.TYPE,- });+ try {+ const piiFreeActor = await this.getPIIFreeBookingAuditActor({+ actor: params.actor,+ });++ const operationId = params.operationId ?? uuidv4();++ await this.tasker.create("bookingAudit", {+ isBulk: false,+ bookingUid: params.bookingUid,+ actor: piiFreeActor,+ organizationId: params.organizationId,+ timestamp: Date.now(),+ action: params.action as BookingAuditAction,+ source: params.source,+ operationId,+ data: params.data,+ context: params.context,+ });+ } catch (error) {+ this.log.error(`Error while queueing ${params.action} audit`, safeStringify(error));}-- async queueBulkCreatedAudit(params: {- bookings: Array<{- bookingUid: string;- data: z.infer<typeof CreatedAuditActionService.latestFieldsSchema>;- }>;- actor: Actor;- organizationId: number | null;- source: ActionSource;- operationId?: string | null;- isBookingAuditEnabled: boolean;- }): Promise<void> {- await this.queueBulkTask({- ...params,- action: CreatedAuditActionService.TYPE,- });+ }++ async queueCreatedAudit(params: {+ bookingUid: string;+ actor: Actor;+ organizationId: number | null;+ source: ActionSource;+ operationId?: string | null;+ data: z.infer<typeof CreatedAuditActionService.latestFieldsSchema>;+ context?: BookingAuditContext;+ isBookingAuditEnabled: boolean;+ }): Promise<void> {+ await this.queueTask({+ ...params,+ action: CreatedAuditActionService.TYPE,+ });+ }++ async queueRescheduledAudit(params: {+ bookingUid: string;+ actor: Actor;+ organizationId: number | null;+ source: ActionSource;+ operationId?: string | null;+ data: z.infer<typeof RescheduledAuditActionService.latestFieldsSchema>;+ context?: BookingAuditContext;+ isBookingAuditEnabled: boolean;+ }): Promise<void> {+ await this.queueTask({+ ...params,+ action: RescheduledAuditActionService.TYPE,+ });+ }++ async queueAcceptedAudit(params: {+ bookingUid: string;+ actor: Actor;+ organizationId: number | null;+ source: ActionSource;+ operationId?: string | null;+ data: z.infer<typeof AcceptedAuditActionService.latestFieldsSchema>;+ context?: BookingAuditContext;+ isBookingAuditEnabled: boolean;+ }): Promise<void> {+ await this.queueTask({+ ...params,+ action: AcceptedAuditActionService.TYPE,+ });+ }++ async queueCancelledAudit(params: {+ bookingUid: string;+ actor: Actor;+ organizationId: number | null;+ source: ActionSource;+ operationId?: string | null;+ data: z.infer<typeof CancelledAuditActionService.latestFieldsSchema>;+ context?: BookingAuditContext;+ isBookingAuditEnabled: boolean;+ }): Promise<void> {+ await this.queueTask({+ ...params,+ action: CancelledAuditActionService.TYPE,+ });+ }++ async queueRescheduleRequestedAudit(params: {+ bookingUid: string;+ actor: Actor;+ organizationId: number | null;+ source: ActionSource;+ operationId?: string | null;+ data: z.infer<typeof RescheduleRequestedAuditActionService.latestFieldsSchema>;+ context?: BookingAuditContext;+ isBookingAuditEnabled: boolean;+ }): Promise<void> {+ await this.queueTask({+ ...params,+ action: RescheduleRequestedAuditActionService.TYPE,+ });+ }++ async queueAttendeeAddedAudit(params: {+ bookingUid: string;+ actor: Actor;+ organizationId: number | null;+ source: ActionSource;+ operationId?: string | null;+ data: z.infer<typeof AttendeeAddedAuditActionService.latestFieldsSchema>;+ context?: BookingAuditContext;+ isBookingAuditEnabled: boolean;+ }): Promise<void> {+ await this.queueTask({+ ...params,+ action: AttendeeAddedAuditActionService.TYPE,+ });+ }++ async queueNoShowUpdatedAudit(params: {+ bookingUid: string;+ actor: Actor;+ organizationId: number | null;+ source: ActionSource;+ operationId?: string | null;+ data: z.infer<typeof NoShowUpdatedAuditActionService.latestFieldsSchema>;+ context?: BookingAuditContext;+ isBookingAuditEnabled: boolean;+ }): Promise<void> {+ await this.queueTask({+ ...params,+ action: NoShowUpdatedAuditActionService.TYPE,+ });+ }++ async queueRejectedAudit(params: {+ bookingUid: string;+ actor: Actor;+ organizationId: number | null;+ source: ActionSource;+ operationId?: string | null;+ data: z.infer<typeof RejectedAuditActionService.latestFieldsSchema>;+ context?: BookingAuditContext;+ isBookingAuditEnabled: boolean;+ }): Promise<void> {+ await this.queueTask({+ ...params,+ action: RejectedAuditActionService.TYPE,+ });+ }++ async queueAttendeeRemovedAudit(params: {+ bookingUid: string;+ actor: Actor;+ organizationId: number | null;+ source: ActionSource;+ operationId?: string | null;+ data: z.infer<typeof AttendeeRemovedAuditActionService.latestFieldsSchema>;+ context?: BookingAuditContext;+ isBookingAuditEnabled: boolean;+ }): Promise<void> {+ await this.queueTask({+ ...params,+ action: AttendeeRemovedAuditActionService.TYPE,+ });+ }++ async queueReassignmentAudit(params: {+ bookingUid: string;+ actor: Actor;+ organizationId: number | null;+ source: ActionSource;+ operationId?: string | null;+ data: z.infer<typeof ReassignmentAuditActionService.latestFieldsSchema>;+ context?: BookingAuditContext;+ isBookingAuditEnabled: boolean;+ }): Promise<void> {+ await this.queueTask({+ ...params,+ action: ReassignmentAuditActionService.TYPE,+ });+ }++ async queueLocationChangedAudit(params: {+ bookingUid: string;+ actor: Actor;+ organizationId: number | null;+ source: ActionSource;+ operationId?: string | null;+ data: z.infer<typeof LocationChangedAuditActionService.latestFieldsSchema>;+ context?: BookingAuditContext;+ isBookingAuditEnabled: boolean;+ }): Promise<void> {+ await this.queueTask({+ ...params,+ action: LocationChangedAuditActionService.TYPE,+ });+ }++ async queueSeatBookedAudit(params: {+ bookingUid: string;+ actor: Actor;+ organizationId: number | null;+ source: ActionSource;+ operationId?: string | null;+ data: z.infer<typeof SeatBookedAuditActionService.latestFieldsSchema>;+ context?: BookingAuditContext;+ isBookingAuditEnabled: boolean;+ }): Promise<void> {+ await this.queueTask({+ ...params,+ action: SeatBookedAuditActionService.TYPE,+ });+ }++ async queueSeatRescheduledAudit(params: {+ bookingUid: string;+ actor: Actor;+ organizationId: number | null;+ source: ActionSource;+ operationId?: string | null;+ data: z.infer<typeof SeatRescheduledAuditActionService.latestFieldsSchema>;+ context?: BookingAuditContext;+ isBookingAuditEnabled: boolean;+ }): Promise<void> {+ await this.queueTask({+ ...params,+ action: SeatRescheduledAuditActionService.TYPE,+ });+ }++ private async queueBulkTask(params: {+ bookings: Array<{+ bookingUid: string;+ data: unknown;+ }>;+ actor: Actor;+ organizationId: number | null;+ action: string;+ source: ActionSource;+ operationId?: string | null;+ context?: BookingAuditContext;+ isBookingAuditEnabled: boolean;+ }): Promise<void> {+ // Skip queueing for non-organization bookings+ if (params.organizationId === null) {+ return;}-- async queueBulkRescheduledAudit(params: {- bookings: Array<{- bookingUid: string;- data: z.infer<typeof RescheduledAuditActionService.latestFieldsSchema>;- }>;- actor: Actor;- organizationId: number | null;- source: ActionSource;- operationId?: string | null;- isBookingAuditEnabled: boolean;- }): Promise<void> {- await this.queueBulkTask({- ...params,- action: RescheduledAuditActionService.TYPE,- });+ // Skip queueing if booking audit is disabled for this organization+ if (!params.isBookingAuditEnabled) {+ this.log.debug(+ `Skipping bulk ${params.action} audit: booking-audit feature is disabled for organization`,+ { organizationId: params.organizationId, bookingCount: params.bookings.length, action: params.action }+ );+ return;}-- async queueBulkRejectedAudit(params: {- bookings: Array<{- bookingUid: string;- data: z.infer<typeof RejectedAuditActionService.latestFieldsSchema>;- }>;- actor: Actor;- organizationId: number | null;- source: ActionSource;- operationId?: string | null;- context?: BookingAuditContext;- isBookingAuditEnabled: boolean;- }): Promise<void> {- await this.queueBulkTask({- ...params,- action: RejectedAuditActionService.TYPE,- });+ try {+ const piiFreeActor = await this.getPIIFreeBookingAuditActor({+ actor: params.actor,+ });++ const operationId = params.operationId ?? uuidv4();++ await this.tasker.create("bookingAudit", {+ isBulk: true,+ bookings: params.bookings,+ actor: piiFreeActor,+ organizationId: params.organizationId,+ timestamp: Date.now(),+ action: params.action as BookingAuditAction,+ source: params.source,+ operationId,+ context: params.context,+ });+ } catch (error) {+ this.log.error(`Error while queueing bulk ${params.action} audit`, safeStringify(error));}+ }++ async queueBulkAcceptedAudit(params: {+ bookings: Array<{+ bookingUid: string;+ data: z.infer<typeof AcceptedAuditActionService.latestFieldsSchema>;+ }>;+ actor: Actor;+ organizationId: number | null;+ source: ActionSource;+ operationId?: string | null;+ context?: BookingAuditContext;+ isBookingAuditEnabled: boolean;+ }): Promise<void> {+ await this.queueBulkTask({+ ...params,+ action: AcceptedAuditActionService.TYPE,+ });+ }++ async queueBulkCancelledAudit(params: {+ bookings: Array<{+ bookingUid: string;+ data: z.infer<typeof CancelledAuditActionService.latestFieldsSchema>;+ }>;+ actor: Actor;+ organizationId: number | null;+ source: ActionSource;+ operationId?: string | null;+ context?: BookingAuditContext;+ isBookingAuditEnabled: boolean;+ }): Promise<void> {+ await this.queueBulkTask({+ ...params,+ action: CancelledAuditActionService.TYPE,+ });+ }++ async queueBulkCreatedAudit(params: {+ bookings: Array<{+ bookingUid: string;+ data: z.infer<typeof CreatedAuditActionService.latestFieldsSchema>;+ }>;+ actor: Actor;+ organizationId: number | null;+ source: ActionSource;+ operationId?: string | null;+ isBookingAuditEnabled: boolean;+ }): Promise<void> {+ await this.queueBulkTask({+ ...params,+ action: CreatedAuditActionService.TYPE,+ });+ }++ async queueBulkRescheduledAudit(params: {+ bookings: Array<{+ bookingUid: string;+ data: z.infer<typeof RescheduledAuditActionService.latestFieldsSchema>;+ }>;+ actor: Actor;+ organizationId: number | null;+ source: ActionSource;+ operationId?: string | null;+ isBookingAuditEnabled: boolean;+ }): Promise<void> {+ await this.queueBulkTask({+ ...params,+ action: RescheduledAuditActionService.TYPE,+ });+ }++ async queueBulkRejectedAudit(params: {+ bookings: Array<{+ bookingUid: string;+ data: z.infer<typeof RejectedAuditActionService.latestFieldsSchema>;+ }>;+ actor: Actor;+ organizationId: number | null;+ source: ActionSource;+ operationId?: string | null;+ context?: BookingAuditContext;+ isBookingAuditEnabled: boolean;+ }): Promise<void> {+ await this.queueBulkTask({+ ...params,+ action: RejectedAuditActionService.TYPE,+ });+ }}diff --git a/packages/features/booking-audit/lib/service/BookingAuditViewerService.ts b/packages/features/booking-audit/lib/service/BookingAuditViewerService.tsindex 4d5a5c888de..ffcfcf6ef16 100644--- a/packages/features/booking-audit/lib/service/BookingAuditViewerService.ts+++ b/packages/features/booking-audit/lib/service/BookingAuditViewerService.ts@@ -339,12 +339,11 @@ export class BookingAuditViewerService {};}-private mergeDataRequirements(...requirements: DataRequirements[]): DataRequirements {const userUuids = new Set<string>();const attendeeIds = new Set<number>();const credentialIds = new Set<number>();-+for (const requirement of requirements) {for (const uuid of requirement.userUuids || []) userUuids.add(uuid);for (const id of requirement.attendeeIds || []) attendeeIds.add(id);@@ -368,7 +367,7 @@ export class BookingAuditViewerService {for (const log of auditLogs) {actorRequirements.push(getActorDataRequirements(log.actor));- const context = log.context+ const context = log.context;if (context?.impersonatedBy) {contextRequirements.push({ userUuids: [context.impersonatedBy] });}@@ -377,7 +376,7 @@ export class BookingAuditViewerService {const actionService = this.actionServiceRegistry.getActionService(log.action);const parsedData = actionService.parseStored(log.data);serviceRequirements.push(actionService.getDataRequirements(parsedData));- } catch(error) {+ } catch (error) {this.log.error(`Failed to get data requirements for action ${log.action}: ${error instanceof Error ? error.message : String(error)}`);diff --git a/packages/features/booking-audit/lib/service/BookingHistoryViewerService.ts b/packages/features/booking-audit/lib/service/BookingHistoryViewerService.tsindex 1c64100770a..239a9cc7a9a 100644--- a/packages/features/booking-audit/lib/service/BookingHistoryViewerService.ts+++ b/packages/features/booking-audit/lib/service/BookingHistoryViewerService.ts@@ -4,102 +4,111 @@ import type { BookingAuditViewerService, DisplayBookingAuditLog } from "./Bookinimport { getFieldResponseByIdentifier } from "@calcom/features/routing-forms/lib/getFieldResponseByIdentifier";type GetHistoryForBookingParams = {- bookingUid: string;- userId: number;- userEmail: string;- userTimeZone: string;- organizationId: number | null;+ bookingUid: string;+ userId: number;+ userEmail: string;+ userTimeZone: string;+ organizationId: number | null;};type BookingHistoryLog = DisplayBookingAuditLog;interface BookingHistoryViewerServiceDeps {- bookingAuditViewerService: BookingAuditViewerService;- routingFormResponseRepository: RoutingFormResponseRepositoryInterface;+ bookingAuditViewerService: BookingAuditViewerService;+ routingFormResponseRepository: RoutingFormResponseRepositoryInterface;}export class BookingHistoryViewerService {- private readonly bookingAuditViewerService: BookingAuditViewerService;- private readonly routingFormResponseRepository: RoutingFormResponseRepositoryInterface;+ private readonly bookingAuditViewerService: BookingAuditViewerService;+ private readonly routingFormResponseRepository: RoutingFormResponseRepositoryInterface;- constructor(private readonly deps: BookingHistoryViewerServiceDeps) {- this.bookingAuditViewerService = deps.bookingAuditViewerService;- this.routingFormResponseRepository = deps.routingFormResponseRepository;- }+ constructor(private readonly deps: BookingHistoryViewerServiceDeps) {+ this.bookingAuditViewerService = deps.bookingAuditViewerService;+ this.routingFormResponseRepository = deps.routingFormResponseRepository;+ }- private sortLogsReverseChronologically(historyLogs: BookingHistoryLog[]): BookingHistoryLog[] {- return historyLogs.sort((a, b) => {- const timestampA = new Date(a.timestamp).getTime();- const timestampB = new Date(b.timestamp).getTime();- return timestampB - timestampA;- });- }+ private sortLogsReverseChronologically(historyLogs: BookingHistoryLog[]): BookingHistoryLog[] {+ return historyLogs.sort((a, b) => {+ const timestampA = new Date(a.timestamp).getTime();+ const timestampB = new Date(b.timestamp).getTime();+ return timestampB - timestampA;+ });+ }- private async getFormAuditLogsForBooking(bookingUid: string): Promise<BookingHistoryLog[]> {- // TODO: Form doesn't have its Audit Logs yet, so we replicate them using the Form Response directly for now.- const formResponse = await this.routingFormResponseRepository.findByBookingUidIncludeForm(bookingUid);- if (!formResponse) {- return [];- }- return [this.createFormSubmissionEntry({ formResponse, bookingUid })];+ private async getFormAuditLogsForBooking(bookingUid: string): Promise<BookingHistoryLog[]> {+ // TODO: Form doesn't have its Audit Logs yet, so we replicate them using the Form Response directly for now.+ const formResponse = await this.routingFormResponseRepository.findByBookingUidIncludeForm(bookingUid);+ if (!formResponse) {+ return [];}+ return [this.createFormSubmissionEntry({ formResponse, bookingUid })];+ }- async getHistoryForBooking(- params: GetHistoryForBookingParams- ): Promise<{ bookingUid: string; auditLogs: BookingHistoryLog[] }> {- const { bookingUid } = params;+ async getHistoryForBooking(+ params: GetHistoryForBookingParams+ ): Promise<{ bookingUid: string; auditLogs: BookingHistoryLog[] }> {+ const { bookingUid } = params;- const { auditLogs: bookingAuditLogs } = await this.bookingAuditViewerService.getAuditLogsForBooking(params);+ const { auditLogs: bookingAuditLogs } =+ await this.bookingAuditViewerService.getAuditLogsForBooking(params);- const historyEntries: BookingHistoryLog[] = [...bookingAuditLogs, ...await this.getFormAuditLogsForBooking(bookingUid)];+ const historyEntries: BookingHistoryLog[] = [+ ...bookingAuditLogs,+ ...(await this.getFormAuditLogsForBooking(bookingUid)),+ ];- const sortedLogs = this.sortLogsReverseChronologically(historyEntries);+ const sortedLogs = this.sortLogsReverseChronologically(historyEntries);- return {- bookingUid,- auditLogs: sortedLogs,- };- }+ return {+ bookingUid,+ auditLogs: sortedLogs,+ };+ }- private createFormSubmissionEntry({- formResponse,- bookingUid,- }: {- formResponse: NonNullable<- Awaited<ReturnType<RoutingFormResponseRepositoryInterface["findByBookingUidIncludeForm"]>>- >;- bookingUid: string;- }): BookingHistoryLog {- const timestamp = formResponse.createdAt.toISOString();+ private createFormSubmissionEntry({+ formResponse,+ bookingUid,+ }: {+ formResponse: NonNullable<+ Awaited<ReturnType<RoutingFormResponseRepositoryInterface["findByBookingUidIncludeForm"]>>+ >;+ bookingUid: string;+ }): BookingHistoryLog {+ const timestamp = formResponse.createdAt.toISOString();- const emailFieldResult = getFieldResponseByIdentifier({ responsePayload: formResponse.response, formFields: formResponse.form.fields, identifier: "email" });- const emailFieldValueFromResponse = emailFieldResult.success ? emailFieldResult.data : null;- // A valid string can be the email otherwise we assume it is not an email- const submitterEmail = typeof emailFieldValueFromResponse === "string" ? emailFieldValueFromResponse : null;- const uniqueId = `form-submission-${formResponse.id}`;- return {- id: uniqueId,- bookingUid,- type: "RECORD_CREATED",- action: "CREATED",- timestamp,- createdAt: timestamp,- source: "WEBAPP",- operationId: uniqueId,- displayJson: null,- actionDisplayTitle: { key: "form_submitted" },- displayFields: null,- actor: {- id: `form-submission-actor-${formResponse.id}`,- type: "GUEST",- userUuid: null,- attendeeId: null,- name: null,- createdAt: formResponse.createdAt,- displayName: submitterEmail ? `${submitterEmail}` : "Guest",- displayEmail: submitterEmail || null,- displayAvatar: null,- },- };- }+ const emailFieldResult = getFieldResponseByIdentifier({+ responsePayload: formResponse.response,+ formFields: formResponse.form.fields,+ identifier: "email",+ });+ const emailFieldValueFromResponse = emailFieldResult.success ? emailFieldResult.data : null;+ // A valid string can be the email otherwise we assume it is not an email+ const submitterEmail =+ typeof emailFieldValueFromResponse === "string" ? emailFieldValueFromResponse : null;+ const uniqueId = `form-submission-${formResponse.id}`;+ return {+ id: uniqueId,+ bookingUid,+ type: "RECORD_CREATED",+ action: "CREATED",+ timestamp,+ createdAt: timestamp,+ source: "WEBAPP",+ operationId: uniqueId,+ displayJson: null,+ actionDisplayTitle: { key: "form_submitted" },+ displayFields: null,+ actor: {+ id: `form-submission-actor-${formResponse.id}`,+ type: "GUEST",+ userUuid: null,+ attendeeId: null,+ name: null,+ createdAt: formResponse.createdAt,+ displayName: submitterEmail ? `${submitterEmail}` : "Guest",+ displayEmail: submitterEmail || null,+ displayAvatar: null,+ },+ };+ }}diff --git a/packages/features/booking-audit/lib/service/__tests__/BookingAuditAccessService.test.ts b/packages/features/booking-audit/lib/service/__tests__/BookingAuditAccessService.test.tsindex d3c61a502cf..1c3c465f08e 100644--- a/packages/features/booking-audit/lib/service/__tests__/BookingAuditAccessService.test.ts+++ b/packages/features/booking-audit/lib/service/__tests__/BookingAuditAccessService.test.ts@@ -5,26 +5,33 @@ import { BookingRepository } from "@calcom/features/bookings/repositories/Bookinimport { MembershipRepository } from "@calcom/features/membership/repositories/MembershipRepository";import { MembershipRole } from "@calcom/prisma/enums";-import { BookingAuditAccessService, BookingAuditErrorCode, BookingAuditPermissionError } from "../BookingAuditAccessService";+import {+ BookingAuditAccessService,+ BookingAuditErrorCode,+ BookingAuditPermissionError,+} from "../BookingAuditAccessService";vi.mock("@calcom/features/pbac/services/permission-check.service");vi.mock("@calcom/features/bookings/repositories/BookingRepository");vi.mock("@calcom/features/membership/repositories/MembershipRepository");const DB = {- bookings: {} as Record<string, {- uid: string;- userId: number | null;- eventType: {- teamId: number | null;- parent: { teamId: number } | null;- hosts: never[];- users: never[];- };- user: { id: number; email: string };- attendees: never[];- }>,+ bookings: {} as Record<+ string,+ {+ uid: string;+ userId: number | null;+ eventType: {+ teamId: number | null;+ parent: { teamId: number } | null;+ hosts: never[];+ users: never[];+ };+ user: { id: number; email: string };+ attendees: never[];+ }+ >,memberships: {} as Record<string, boolean>,-}+};const createMockTeamBooking = (overrides: {bookingUid: string;@@ -36,20 +43,20 @@ const createMockTeamBooking = (overrides: {uid: overrides.bookingUid,userId: overrides?.userId ?? 456,eventType: {- teamId: (overrides && "teamId" in overrides ? overrides.teamId : overrides?.teamId ?? 100) ?? null,+ teamId: (overrides && "teamId" in overrides ? overrides.teamId : (overrides?.teamId ?? 100)) ?? null,parent: (overrides?.parentTeamId ? { teamId: overrides.parentTeamId } : undefined) ?? null,hosts: [],- users: []+ users: [],},user: {id: overrides?.userId ?? 456,email: "[email protected]",},attendees: [],- }+ };DB.bookings[booking.uid] = booking;return booking;-}+};const createMockPersonalBooking = (overrides: { userId?: number; bookingUid: string }) => {const booking = {@@ -69,7 +76,7 @@ const createMockPersonalBooking = (overrides: { userId?: number; bookingUid: str};DB.bookings[booking.uid] = booking;return booking;-}+};const createMockMembership = ({ userId, teamId }: { userId: number; teamId: number }) => {const key = `${userId}-${teamId}`;@@ -78,25 +85,49 @@ const createMockMembership = ({ userId, teamId }: { userId: number; teamId: numbtype MockPermissionCheckService = {checkPermission: Mock<PermissionCheckService["checkPermission"]>;-}+};-const provideReadTeamAuditLogsPermission = ({ mockPermissionCheckService, value, targetUserId, targetTeamId }: { mockPermissionCheckService: MockPermissionCheckService, value: boolean, targetUserId: number, targetTeamId: number }) => {- mockPermissionCheckService.checkPermission.mockImplementation(({ userId, teamId, permission, _fallbackRoles }) => {- if (permission === "booking.readTeamAuditLogs" && userId === targetUserId && teamId === targetTeamId) {- return Promise.resolve(value);+const provideReadTeamAuditLogsPermission = ({+ mockPermissionCheckService,+ value,+ targetUserId,+ targetTeamId,+}: {+ mockPermissionCheckService: MockPermissionCheckService;+ value: boolean;+ targetUserId: number;+ targetTeamId: number;+}) => {+ mockPermissionCheckService.checkPermission.mockImplementation(+ ({ userId, teamId, permission, _fallbackRoles }) => {+ if (permission === "booking.readTeamAuditLogs" && userId === targetUserId && teamId === targetTeamId) {+ return Promise.resolve(value);+ }+ return Promise.resolve(false);}- return Promise.resolve(false);- });-}+ );+};-const provideReadOrgAuditLogsPermission = ({ mockPermissionCheckService, value, targetUserId, targetTeamId }: { mockPermissionCheckService: MockPermissionCheckService, value: boolean, targetUserId: number, targetTeamId: number }) => {- mockPermissionCheckService.checkPermission.mockImplementation(({ userId, teamId, permission, _fallbackRoles }) => {- if (permission === "booking.readOrgAuditLogs" && userId === targetUserId && teamId === targetTeamId) {- return Promise.resolve(value);+const provideReadOrgAuditLogsPermission = ({+ mockPermissionCheckService,+ value,+ targetUserId,+ targetTeamId,+}: {+ mockPermissionCheckService: MockPermissionCheckService;+ value: boolean;+ targetUserId: number;+ targetTeamId: number;+}) => {+ mockPermissionCheckService.checkPermission.mockImplementation(+ ({ userId, teamId, permission, _fallbackRoles }) => {+ if (permission === "booking.readOrgAuditLogs" && userId === targetUserId && teamId === targetTeamId) {+ return Promise.resolve(value);+ }+ return Promise.resolve(false);}- return Promise.resolve(false);- });-}+ );+};const mockBookingRepository: {findByUidIncludeEventType: Mock<BookingRepository["findByUidIncludeEventType"]>;@@ -130,9 +161,15 @@ describe("BookingAuditAccessService - Permission Checks", () => {checkPermission: vi.fn(),};- vi.mocked(BookingRepository).mockImplementation(function() { return mockBookingRepository as unknown as BookingRepository; });- vi.mocked(MembershipRepository).mockImplementation(function() { return mockMembershipRepository as unknown as MembershipRepository; });- vi.mocked(PermissionCheckService).mockImplementation(function() { return mockPermissionCheckService as unknown as PermissionCheckService; });+ vi.mocked(BookingRepository).mockImplementation(function () {+ return mockBookingRepository as unknown as BookingRepository;+ });+ vi.mocked(MembershipRepository).mockImplementation(function () {+ return mockMembershipRepository as unknown as MembershipRepository;+ });+ vi.mocked(PermissionCheckService).mockImplementation(function () {+ return mockPermissionCheckService as unknown as PermissionCheckService;+ });service = new BookingAuditAccessService({bookingRepository: mockBookingRepository as unknown as BookingRepository,@@ -146,9 +183,16 @@ describe("BookingAuditAccessService - Permission Checks", () => {const userId = 123;const teamId = 100;createMockTeamBooking({ teamId, bookingUid });- provideReadTeamAuditLogsPermission({ mockPermissionCheckService, value: true, targetUserId: userId, targetTeamId: teamId });+ provideReadTeamAuditLogsPermission({+ mockPermissionCheckService,+ value: true,+ targetUserId: userId,+ targetTeamId: teamId,+ });- await expect(service.assertPermissions({ bookingUid, userId, organizationId: 200 })).resolves.not.toThrow();+ await expect(+ service.assertPermissions({ bookingUid, userId, organizationId: 200 })+ ).resolves.not.toThrow();});it("should throw PERMISSION_DENIED error when user lacks booking.readTeamAuditLogs permission and also doesn't even have a membership in the organization for the booking's team", async () => {@@ -158,8 +202,18 @@ describe("BookingAuditAccessService - Permission Checks", () => {const organizationId = 200;createMockTeamBooking({ teamId, bookingUid, userId: 456 });createMockMembership({ userId: 456, teamId: organizationId });- provideReadTeamAuditLogsPermission({ mockPermissionCheckService, value: false, targetUserId: userId, targetTeamId: teamId });- provideReadOrgAuditLogsPermission({ mockPermissionCheckService, value: false, targetUserId: userId, targetTeamId: organizationId });+ provideReadTeamAuditLogsPermission({+ mockPermissionCheckService,+ value: false,+ targetUserId: userId,+ targetTeamId: teamId,+ });+ provideReadOrgAuditLogsPermission({+ mockPermissionCheckService,+ value: false,+ targetUserId: userId,+ targetTeamId: organizationId,+ });const promise = service.assertPermissions({ bookingUid, userId, organizationId });await expect(promise).rejects.toThrow(BookingAuditPermissionError);await expect(promise).rejects.toThrow(BookingAuditErrorCode.PERMISSION_DENIED);@@ -173,7 +227,12 @@ describe("BookingAuditAccessService - Permission Checks", () => {const organizationId = 200;createMockPersonalBooking({ userId: 456, bookingUid });createMockMembership({ userId: 456, teamId: organizationId });- provideReadOrgAuditLogsPermission({ mockPermissionCheckService, value: true, targetUserId: userId, targetTeamId: organizationId });+ provideReadOrgAuditLogsPermission({+ mockPermissionCheckService,+ value: true,+ targetUserId: userId,+ targetTeamId: organizationId,+ });await service.assertPermissions({ bookingUid, userId, organizationId });@@ -192,7 +251,12 @@ describe("BookingAuditAccessService - Permission Checks", () => {const userId = 123;const parentTeamId = 500;createMockTeamBooking({ teamId: null, parentTeamId, bookingUid });- provideReadTeamAuditLogsPermission({ mockPermissionCheckService, value: true, targetUserId: userId, targetTeamId: parentTeamId });+ provideReadTeamAuditLogsPermission({+ mockPermissionCheckService,+ value: true,+ targetUserId: userId,+ targetTeamId: parentTeamId,+ });await service.assertPermissions({ bookingUid, userId, organizationId: 200 });@@ -211,25 +275,45 @@ describe("BookingAuditAccessService - Permission Checks", () => {const organizationId = 200;createMockTeamBooking({ teamId: null, parentTeamId, bookingUid, userId: 456 });createMockMembership({ userId: 456, teamId: organizationId });- provideReadTeamAuditLogsPermission({ mockPermissionCheckService, value: false, targetUserId: userId, targetTeamId: parentTeamId });- provideReadOrgAuditLogsPermission({ mockPermissionCheckService, value: false, targetUserId: userId, targetTeamId: organizationId });+ provideReadTeamAuditLogsPermission({+ mockPermissionCheckService,+ value: false,+ targetUserId: userId,+ targetTeamId: parentTeamId,+ });+ provideReadOrgAuditLogsPermission({+ mockPermissionCheckService,+ value: false,+ targetUserId: userId,+ targetTeamId: organizationId,+ });- await expect(service.assertPermissions({ bookingUid, userId, organizationId })).rejects.toThrow(BookingAuditPermissionError);+ await expect(service.assertPermissions({ bookingUid, userId, organizationId })).rejects.toThrow(+ BookingAuditPermissionError+ );});});describe("assertPermissions - Edge Cases", () => {it("should throw error when organizationId is null", async () => {- await expect(service.assertPermissions({ bookingUid: "test-booking-uid", userId: 123, organizationId: null })).rejects.toThrow(BookingAuditPermissionError);- await expect(service.assertPermissions({ bookingUid: "test-booking-uid", userId: 123, organizationId: null })).rejects.toThrow(BookingAuditErrorCode.ORGANIZATION_ID_REQUIRED);+ await expect(+ service.assertPermissions({ bookingUid: "test-booking-uid", userId: 123, organizationId: null })+ ).rejects.toThrow(BookingAuditPermissionError);+ await expect(+ service.assertPermissions({ bookingUid: "test-booking-uid", userId: 123, organizationId: null })+ ).rejects.toThrow(BookingAuditErrorCode.ORGANIZATION_ID_REQUIRED);});it("should throw error when booking not found", async () => {const bookingUid = "non-existent-booking-uid";// Don't create any booking in DB- await expect(service.assertPermissions({ bookingUid, userId: 123, organizationId: 200 })).rejects.toThrow(BookingAuditPermissionError);- await expect(service.assertPermissions({ bookingUid, userId: 123, organizationId: 200 })).rejects.toThrow(BookingAuditErrorCode.BOOKING_NOT_FOUND_OR_PERMISSION_DENIED);+ await expect(+ service.assertPermissions({ bookingUid, userId: 123, organizationId: 200 })+ ).rejects.toThrow(BookingAuditPermissionError);+ await expect(+ service.assertPermissions({ bookingUid, userId: 123, organizationId: 200 })+ ).rejects.toThrow(BookingAuditErrorCode.BOOKING_NOT_FOUND_OR_PERMISSION_DENIED);});it("should throw error when booking has no userId", async () => {@@ -251,8 +335,12 @@ describe("BookingAuditAccessService - Permission Checks", () => {};DB.bookings[bookingUid] = booking;- await expect(service.assertPermissions({ bookingUid, userId: 123, organizationId: 200 })).rejects.toThrow(BookingAuditPermissionError);- await expect(service.assertPermissions({ bookingUid, userId: 123, organizationId: 200 })).rejects.toThrow(BookingAuditErrorCode.BOOKING_HAS_NO_OWNER);+ await expect(+ service.assertPermissions({ bookingUid, userId: 123, organizationId: 200 })+ ).rejects.toThrow(BookingAuditPermissionError);+ await expect(+ service.assertPermissions({ bookingUid, userId: 123, organizationId: 200 })+ ).rejects.toThrow(BookingAuditErrorCode.BOOKING_HAS_NO_OWNER);});it("should throw error when booking owner is not member of organization", async () => {@@ -260,8 +348,12 @@ describe("BookingAuditAccessService - Permission Checks", () => {createMockPersonalBooking({ userId: 456, bookingUid });// Don't create membership for userId 456 in organization 200- await expect(service.assertPermissions({ bookingUid, userId: 123, organizationId: 200 })).rejects.toThrow(BookingAuditPermissionError);- await expect(service.assertPermissions({ bookingUid, userId: 123, organizationId: 200 })).rejects.toThrow(BookingAuditErrorCode.OWNER_NOT_IN_ORGANIZATION);+ await expect(+ service.assertPermissions({ bookingUid, userId: 123, organizationId: 200 })+ ).rejects.toThrow(BookingAuditPermissionError);+ await expect(+ service.assertPermissions({ bookingUid, userId: 123, organizationId: 200 })+ ).rejects.toThrow(BookingAuditErrorCode.OWNER_NOT_IN_ORGANIZATION);});});});diff --git a/packages/features/booking-audit/lib/service/__tests__/BookingAuditViewerService.test.ts b/packages/features/booking-audit/lib/service/__tests__/BookingAuditViewerService.test.tsindex 2ecf8ac4838..8879e7a76df 100644--- a/packages/features/booking-audit/lib/service/__tests__/BookingAuditViewerService.test.ts+++ b/packages/features/booking-audit/lib/service/__tests__/BookingAuditViewerService.test.ts@@ -158,7 +158,13 @@ type MockUser = {const createMockUser = (uuid?: string,- overrides?: Partial<{ id: number; uuid: string; name: string | null; email: string; avatarUrl: string | null }>+ overrides?: Partial<{+ id: number;+ uuid: string;+ name: string | null;+ email: string;+ avatarUrl: string | null;+ }>) => {const userUuid = uuid ?? overrides?.uuid ?? `user-uuid-${overrides?.id ?? 123}`;const user: MockUser = {diff --git a/packages/features/booking-audit/lib/service/__tests__/EnrichmentDataStore.test.ts b/packages/features/booking-audit/lib/service/__tests__/EnrichmentDataStore.test.tsindex 6d0b16f66f4..cd4f81ce989 100644--- a/packages/features/booking-audit/lib/service/__tests__/EnrichmentDataStore.test.ts+++ b/packages/features/booking-audit/lib/service/__tests__/EnrichmentDataStore.test.ts@@ -31,10 +31,7 @@ describe("EnrichmentDataStore", () => {describe("constructor", () => {it("should pre-populate usersByUuid map with nulls for declared userUuids", () => {- const store = new EnrichmentDataStore(- { userUuids: ["uuid-1", "uuid-2"] },- repositories- );+ const store = new EnrichmentDataStore({ userUuids: ["uuid-1", "uuid-2"] }, repositories);expect(() => store.getUserByUuid("uuid-1")).not.toThrow();expect(() => store.getUserByUuid("uuid-2")).not.toThrow();@@ -43,10 +40,7 @@ describe("EnrichmentDataStore", () => {});it("should pre-populate attendeesById map with nulls for declared attendeeIds", () => {- const store = new EnrichmentDataStore(- { attendeeIds: [1, 2, 3] },- repositories- );+ const store = new EnrichmentDataStore({ attendeeIds: [1, 2, 3] }, repositories);expect(() => store.getAttendeeById(1)).not.toThrow();expect(() => store.getAttendeeById(2)).not.toThrow();@@ -55,10 +49,7 @@ describe("EnrichmentDataStore", () => {});it("should pre-populate credentialsById map with nulls for declared credentialIds", () => {- const store = new EnrichmentDataStore(- { credentialIds: [10, 20] },- repositories- );+ const store = new EnrichmentDataStore({ credentialIds: [10, 20] }, repositories);expect(() => store.getCredentialById(10)).not.toThrow();expect(() => store.getCredentialById(20)).not.toThrow();@@ -82,10 +73,7 @@ describe("EnrichmentDataStore", () => {];vi.mocked(mockUserRepository.findByUuids).mockResolvedValue(mockUsers);- const store = new EnrichmentDataStore(- { userUuids: ["uuid-1", "uuid-2"] },- repositories- );+ const store = new EnrichmentDataStore({ userUuids: ["uuid-1", "uuid-2"] }, repositories);await store.fetch();expect(mockUserRepository.findByUuids).toHaveBeenCalledWith({ uuids: ["uuid-1", "uuid-2"] });@@ -100,10 +88,7 @@ describe("EnrichmentDataStore", () => {];vi.mocked(mockAttendeeRepository.findByIds).mockResolvedValue(mockAttendees);- const store = new EnrichmentDataStore(- { attendeeIds: [1, 2] },- repositories- );+ const store = new EnrichmentDataStore({ attendeeIds: [1, 2] }, repositories);await store.fetch();expect(mockAttendeeRepository.findByIds).toHaveBeenCalledWith({ ids: [1, 2] });@@ -118,10 +103,7 @@ describe("EnrichmentDataStore", () => {];vi.mocked(mockCredentialRepository.findByIds).mockResolvedValue(mockCredentials);- const store = new EnrichmentDataStore(- { credentialIds: [10, 20] },- repositories- );+ const store = new EnrichmentDataStore({ credentialIds: [10, 20] }, repositories);await store.fetch();expect(mockCredentialRepository.findByIds).toHaveBeenCalledWith({ ids: [10, 20] });@@ -136,9 +118,7 @@ describe("EnrichmentDataStore", () => {vi.mocked(mockAttendeeRepository.findByIds).mockResolvedValue([{ id: 1, name: "Attendee", email: "[email protected]" },]);- vi.mocked(mockCredentialRepository.findByIds).mockResolvedValue([- { id: 10, appId: "app" },- ]);+ vi.mocked(mockCredentialRepository.findByIds).mockResolvedValue([{ id: 10, appId: "app" }]);const store = new EnrichmentDataStore({ userUuids: ["uuid-1"], attendeeIds: [1], credentialIds: [10] },@@ -165,10 +145,7 @@ describe("EnrichmentDataStore", () => {{ id: 1, uuid: "uuid-1", name: "User 1", email: "[email protected]", avatarUrl: null },]);- const store = new EnrichmentDataStore(- { userUuids: ["uuid-1", "uuid-2", "uuid-3"] },- repositories- );+ const store = new EnrichmentDataStore({ userUuids: ["uuid-1", "uuid-2", "uuid-3"] }, repositories);await store.fetch();expect(store.getUserByUuid("uuid-1")).not.toBeNull();@@ -179,10 +156,7 @@ describe("EnrichmentDataStore", () => {describe("getUserByUuid", () => {it("should throw error when accessing undeclared UUID", () => {- const store = new EnrichmentDataStore(- { userUuids: ["uuid-1"] },- repositories- );+ const store = new EnrichmentDataStore({ userUuids: ["uuid-1"] }, repositories);expect(() => store.getUserByUuid("undeclared-uuid")).toThrow('EnrichmentDataStore: getUserByUuid("undeclared-uuid") called but was not declared in getDataRequirements'@@ -192,23 +166,23 @@ describe("EnrichmentDataStore", () => {it("should return null for declared UUID that does not exist in database", async () => {vi.mocked(mockUserRepository.findByUuids).mockResolvedValue([]);- const store = new EnrichmentDataStore(- { userUuids: ["uuid-1"] },- repositories- );+ const store = new EnrichmentDataStore({ userUuids: ["uuid-1"] }, repositories);await store.fetch();expect(store.getUserByUuid("uuid-1")).toBeNull();});it("should return user data for declared UUID that exists in database", async () => {- const mockUser = { id: 1, uuid: "uuid-1", name: "Test User", email: "[email protected]", avatarUrl: null };+ const mockUser = {+ id: 1,+ uuid: "uuid-1",+ name: "Test User",+ email: "[email protected]",+ avatarUrl: null,+ };vi.mocked(mockUserRepository.findByUuids).mockResolvedValue([mockUser]);- const store = new EnrichmentDataStore(- { userUuids: ["uuid-1"] },- repositories- );+ const store = new EnrichmentDataStore({ userUuids: ["uuid-1"] }, repositories);await store.fetch();expect(store.getUserByUuid("uuid-1")).toEqual(mockUser);@@ -217,10 +191,7 @@ describe("EnrichmentDataStore", () => {describe("getAttendeeById", () => {it("should throw error when accessing undeclared attendee ID", () => {- const store = new EnrichmentDataStore(- { attendeeIds: [1] },- repositories- );+ const store = new EnrichmentDataStore({ attendeeIds: [1] }, repositories);expect(() => store.getAttendeeById(999)).toThrow("EnrichmentDataStore: getAttendeeById(999) called but was not declared in getDataRequirements"@@ -230,10 +201,7 @@ describe("EnrichmentDataStore", () => {it("should return null for declared ID that does not exist in database", async () => {vi.mocked(mockAttendeeRepository.findByIds).mockResolvedValue([]);- const store = new EnrichmentDataStore(- { attendeeIds: [1] },- repositories- );+ const store = new EnrichmentDataStore({ attendeeIds: [1] }, repositories);await store.fetch();expect(store.getAttendeeById(1)).toBeNull();@@ -243,10 +211,7 @@ describe("EnrichmentDataStore", () => {const mockAttendee = { id: 1, name: "Test Attendee", email: "[email protected]" };vi.mocked(mockAttendeeRepository.findByIds).mockResolvedValue([mockAttendee]);- const store = new EnrichmentDataStore(- { attendeeIds: [1] },- repositories- );+ const store = new EnrichmentDataStore({ attendeeIds: [1] }, repositories);await store.fetch();expect(store.getAttendeeById(1)).toEqual(mockAttendee);@@ -255,10 +220,7 @@ describe("EnrichmentDataStore", () => {describe("getCredentialById", () => {it("should throw error when accessing undeclared credential ID", () => {- const store = new EnrichmentDataStore(- { credentialIds: [10] },- repositories- );+ const store = new EnrichmentDataStore({ credentialIds: [10] }, repositories);expect(() => store.getCredentialById(999)).toThrow("EnrichmentDataStore: getCredentialById(999) called but was not declared in getDataRequirements"@@ -268,10 +230,7 @@ describe("EnrichmentDataStore", () => {it("should return null for declared ID that does not exist in database", async () => {vi.mocked(mockCredentialRepository.findByIds).mockResolvedValue([]);- const store = new EnrichmentDataStore(- { credentialIds: [10] },- repositories- );+ const store = new EnrichmentDataStore({ credentialIds: [10] }, repositories);await store.fetch();expect(store.getCredentialById(10)).toBeNull();@@ -281,10 +240,7 @@ describe("EnrichmentDataStore", () => {const mockCredential = { id: 10, appId: "google-calendar" };vi.mocked(mockCredentialRepository.findByIds).mockResolvedValue([mockCredential]);- const store = new EnrichmentDataStore(- { credentialIds: [10] },- repositories- );+ const store = new EnrichmentDataStore({ credentialIds: [10] }, repositories);await store.fetch();expect(store.getCredentialById(10)).toEqual(mockCredential);@@ -300,10 +256,7 @@ describe("EnrichmentDataStore", () => {];vi.mocked(mockUserRepository.findByUuids).mockResolvedValue(mockUsers);- const store = new EnrichmentDataStore(- { userUuids: ["uuid-1", "uuid-2", "uuid-3"] },- repositories- );+ const store = new EnrichmentDataStore({ userUuids: ["uuid-1", "uuid-2", "uuid-3"] }, repositories);await store.fetch();expect(store.getUserByUuid("uuid-1")).toEqual(mockUsers[0]);diff --git a/packages/features/booking-audit/lib/service/__tests__/cancelled-action.integration-test.ts b/packages/features/booking-audit/lib/service/__tests__/cancelled-action.integration-test.tsindex 61b45b615c4..b52f81a474e 100644--- a/packages/features/booking-audit/lib/service/__tests__/cancelled-action.integration-test.ts+++ b/packages/features/booking-audit/lib/service/__tests__/cancelled-action.integration-test.ts@@ -123,4 +123,3 @@ describe("Cancelled Action Integration", () => {});});});-diff --git a/packages/features/booking-audit/lib/types/actionSource.ts b/packages/features/booking-audit/lib/types/actionSource.tsindex c03a743d385..085c2adb606 100644--- a/packages/features/booking-audit/lib/types/actionSource.ts+++ b/packages/features/booking-audit/lib/types/actionSource.ts@@ -2,10 +2,25 @@ import { z } from "zod";// This is the schema for DB value, here we use UNKNOWN in case client didn't pass an explicit action source.// SYSTEM is used for background jobs (tasker tasks, trigger.dev, etc.)-export const ActionSourceSchema = z.enum(["API_V1", "API_V2", "WEBAPP", "WEBHOOK", "MAGIC_LINK", "SYSTEM", "UNKNOWN"]);+export const ActionSourceSchema = z.enum([+ "API_V1",+ "API_V2",+ "WEBAPP",+ "WEBHOOK",+ "MAGIC_LINK",+ "SYSTEM",+ "UNKNOWN",+]);export type ActionSource = z.infer<typeof ActionSourceSchema>;// We don't keep UNKNOWN here because we don't want clients to pass UNKNOWN.// SYSTEM is used for background jobs (tasker tasks, trigger.dev, etc.)-export const ValidActionSourceSchema = z.enum(["API_V1", "API_V2", "WEBAPP", "WEBHOOK", "MAGIC_LINK", "SYSTEM"]);+export const ValidActionSourceSchema = z.enum([+ "API_V1",+ "API_V2",+ "WEBAPP",+ "WEBHOOK",+ "MAGIC_LINK",+ "SYSTEM",+]);export type ValidActionSource = z.infer<typeof ValidActionSourceSchema>;diff --git a/packages/features/booking-audit/lib/types/bookingAuditTask.ts b/packages/features/booking-audit/lib/types/bookingAuditTask.tsindex 3ebc9a61f73..5d6916ba831 100644--- a/packages/features/booking-audit/lib/types/bookingAuditTask.ts+++ b/packages/features/booking-audit/lib/types/bookingAuditTask.ts@@ -8,19 +8,19 @@ import { ActionSourceSchema } from "./actionSource";* Used for runtime validation of action field*/const BookingAuditActionSchema = z.enum([- "CREATED",- "RESCHEDULED",- "ACCEPTED",- "CANCELLED",- "RESCHEDULE_REQUESTED",- "ATTENDEE_ADDED",- "REJECTED",- "ATTENDEE_REMOVED",- "REASSIGNMENT",- "LOCATION_CHANGED",- "NO_SHOW_UPDATED",- "SEAT_BOOKED",- "SEAT_RESCHEDULED",+ "CREATED",+ "RESCHEDULED",+ "ACCEPTED",+ "CANCELLED",+ "RESCHEDULE_REQUESTED",+ "ATTENDEE_ADDED",+ "REJECTED",+ "ATTENDEE_REMOVED",+ "REASSIGNMENT",+ "LOCATION_CHANGED",+ "NO_SHOW_UPDATED",+ "SEAT_BOOKED",+ "SEAT_RESCHEDULED",]);export type BookingAuditAction = z.infer<typeof BookingAuditActionSchema>;@@ -28,48 +28,48 @@ export type BookingAuditAction = z.infer<typeof BookingAuditActionSchema>;const actionAgnosticDataSchema = z.unknown();const bookingAuditPayloadSchema = z.object({- bookingUid: z.string(),- data: actionAgnosticDataSchema,+ bookingUid: z.string(),+ data: actionAgnosticDataSchema,});export const SingleBookingAuditTaskConsumerSchema = z.object({- isBulk: z.literal(false),- ...bookingAuditPayloadSchema.shape,- actor: PiiFreeActorSchema,- organizationId: z.number().nullable(),- timestamp: z.number(),- action: BookingAuditActionSchema,- source: ActionSourceSchema.default("UNKNOWN"),- operationId: z.string(),- context: BookingAuditContextSchema.optional(),+ isBulk: z.literal(false),+ ...bookingAuditPayloadSchema.shape,+ actor: PiiFreeActorSchema,+ organizationId: z.number().nullable(),+ timestamp: z.number(),+ action: BookingAuditActionSchema,+ source: ActionSourceSchema.default("UNKNOWN"),+ operationId: z.string(),+ context: BookingAuditContextSchema.optional(),});export type SingleBookingAuditTaskConsumerPayload = z.infer<typeof SingleBookingAuditTaskConsumerSchema>;/*** Bulk booking audit task payload schema- *+ ** Used for operations that affect multiple bookings in a single action.* Contains an array of bookings, each with bookingUid and action-specific data.* All bookings share the same actor, organizationId, timestamp, action, source, and operationId.*/export const BulkBookingAuditTaskConsumerSchema = z.object({- isBulk: z.literal(true),- bookings: z.array(bookingAuditPayloadSchema).min(1),- actor: PiiFreeActorSchema,- organizationId: z.number().nullable(),- timestamp: z.number(),- action: BookingAuditActionSchema,- source: ActionSourceSchema.default("UNKNOWN"),- operationId: z.string(),- context: BookingAuditContextSchema.optional(),+ isBulk: z.literal(true),+ bookings: z.array(bookingAuditPayloadSchema).min(1),+ actor: PiiFreeActorSchema,+ organizationId: z.number().nullable(),+ timestamp: z.number(),+ action: BookingAuditActionSchema,+ source: ActionSourceSchema.default("UNKNOWN"),+ operationId: z.string(),+ context: BookingAuditContextSchema.optional(),});export type BulkBookingAuditTaskConsumerPayload = z.infer<typeof BulkBookingAuditTaskConsumerSchema>;export const BookingAuditTaskConsumerSchema = z.discriminatedUnion("isBulk", [- SingleBookingAuditTaskConsumerSchema,- BulkBookingAuditTaskConsumerSchema,+ SingleBookingAuditTaskConsumerSchema,+ BulkBookingAuditTaskConsumerSchema,]);export type BookingAuditTaskConsumerPayload = z.infer<typeof BookingAuditTaskConsumerSchema>;diff --git a/packages/features/bookings/Booker/hooks/useBookerLayout.ts b/packages/features/bookings/Booker/hooks/useBookerLayout.tsindex ec5d345cd2a..27fd8f7cc86 100644--- a/packages/features/bookings/Booker/hooks/useBookerLayout.ts+++ b/packages/features/bookings/Booker/hooks/useBookerLayout.ts@@ -103,4 +103,4 @@ export const useBookerLayout = (slotsViewOnSmallScreen,bookerLayouts,};-};\ No newline at end of file+};diff --git a/packages/features/bookings/Booker/hooks/useBookerTime.ts b/packages/features/bookings/Booker/hooks/useBookerTime.tsindex 2b34d8614d7..9b9a50782da 100644--- a/packages/features/bookings/Booker/hooks/useBookerTime.ts+++ b/packages/features/bookings/Booker/hooks/useBookerTime.ts@@ -17,4 +17,4 @@ export const useBookerTime = () => {timezoneFromBookerStore,timezoneFromTimePreferences,};-};\ No newline at end of file+};diff --git a/packages/features/bookings/Booker/hooks/useBookingForm.ts b/packages/features/bookings/Booker/hooks/useBookingForm.tsindex 2d2dd926917..44a7c24d38e 100644--- a/packages/features/bookings/Booker/hooks/useBookingForm.ts+++ b/packages/features/bookings/Booker/hooks/useBookingForm.ts@@ -127,4 +127,4 @@ export const useBookingForm = ({formErrors: errors,errors,};-};\ No newline at end of file+};diff --git a/packages/features/bookings/Booker/hooks/useInitialFormValues.test.ts b/packages/features/bookings/Booker/hooks/useInitialFormValues.test.tsindex 6834f94fb09..f358cd603a7 100644--- a/packages/features/bookings/Booker/hooks/useInitialFormValues.test.ts+++ b/packages/features/bookings/Booker/hooks/useInitialFormValues.test.ts@@ -291,4 +291,4 @@ describe("useInitialFormValues - Autofill Disable Feature", () => {expect(result.current.values.responses?.phone).toBeUndefined();});});-});\ No newline at end of file+});diff --git a/packages/features/bookings/Booker/hooks/useInitialFormValues.ts b/packages/features/bookings/Booker/hooks/useInitialFormValues.tsindex 98d52175760..31091140b22 100644--- a/packages/features/bookings/Booker/hooks/useInitialFormValues.ts+++ b/packages/features/bookings/Booker/hooks/useInitialFormValues.ts@@ -212,4 +212,4 @@ export function useInitialFormValues({]);return initialValuesState;-}\ No newline at end of file+}diff --git a/packages/features/bookings/Booker/hooks/useLocalSet.tsx b/packages/features/bookings/Booker/hooks/useLocalSet.tsxindex 7709f7bcad1..67a8609c8cc 100644--- a/packages/features/bookings/Booker/hooks/useLocalSet.tsx+++ b/packages/features/bookings/Booker/hooks/useLocalSet.tsx@@ -68,4 +68,4 @@ export function useLocalSet<T extends HasExternalId>(key: string, initialValue:};return { set, addValue, removeById, toggleValue, hasItem, clearSet };-}\ No newline at end of file+}diff --git a/packages/features/bookings/Booker/store.ts b/packages/features/bookings/Booker/store.tsindex 4f45f258aeb..e436eb42bad 100644--- a/packages/features/bookings/Booker/store.ts+++ b/packages/features/bookings/Booker/store.ts@@ -9,11 +9,7 @@ import { BookerLayouts } from "@calcom/prisma/zod-utils";import type { GetBookingType } from "../lib/get-booking";import type { BookerState, BookerLayout } from "./types";-import {- updateQueryParam,- getQueryParam,- removeQueryParam,-} from "./utils/query-param";+import { updateQueryParam, getQueryParam, removeQueryParam } from "./utils/query-param";const _iso_3166_1_alpha_2_codes = ["ad",@@ -357,9 +353,7 @@ export type BookerStore = {* Multiple Selected Dates and Times*/selectedDatesAndTimes: { [key: string]: { [key: string]: string[] } } | null;- setSelectedDatesAndTimes: (selectedDatesAndTimes: {- [key: string]: { [key: string]: string[] };- }) => void;+ setSelectedDatesAndTimes: (selectedDatesAndTimes: { [key: string]: { [key: string]: string[] } }) => void;/*** Multiple duration configuration*/@@ -457,10 +451,7 @@ export const createBookerStore = () =>setLayout: (layout: BookerLayout) => {// If we switch to a large layout and don't have a date selected yet,// we selected it here, so week title is rendered properly.- if (- ["week_view", "column_view"].includes(layout) &&- !get().selectedDate- ) {+ if (["week_view", "column_view"].includes(layout) && !get().selectedDate) {set({ selectedDate: dayjs().format("YYYY-MM-DD") });}if (!get().isPlatform || get().allowUpdatingUrlParams) {@@ -469,11 +460,7 @@ export const createBookerStore = () =>return set({ layout });},selectedDate: getQueryParam("date") || null,- setSelectedDate: ({- date: selectedDate,- omitUpdatingParams = false,- preventMonthSwitching = false,- }) => {+ setSelectedDate: ({ date: selectedDate, omitUpdatingParams = false, preventMonthSwitching = false }) => {// unset selected dateif (!selectedDate) {removeQueryParam("date");@@ -483,24 +470,15 @@ export const createBookerStore = () =>const currentSelection = dayjs(get().selectedDate);const newSelection = dayjs(selectedDate);set({ selectedDate });- if (- !omitUpdatingParams &&- (!get().isPlatform || get().allowUpdatingUrlParams)- ) {+ if (!omitUpdatingParams && (!get().isPlatform || get().allowUpdatingUrlParams)) {updateQueryParam("date", selectedDate ?? "");}// Setting month make sure small calendar in fullscreen layouts also updates.// preventMonthSwitching is true in monthly view- if (- !preventMonthSwitching &&- newSelection.month() !== currentSelection.month()- ) {+ if (!preventMonthSwitching && newSelection.month() !== currentSelection.month()) {set({ month: newSelection.format("YYYY-MM") });- if (- !omitUpdatingParams &&- (!get().isPlatform || get().allowUpdatingUrlParams)- ) {+ if (!omitUpdatingParams && (!get().isPlatform || get().allowUpdatingUrlParams)) {updateQueryParam("month", newSelection.format("YYYY-MM"));}}@@ -561,8 +539,7 @@ export const createBookerStore = () =>}get().setSelectedDate({ date: null });},- dayCount:- BOOKER_NUMBER_OF_DAYS_TO_LOAD > 0 ? BOOKER_NUMBER_OF_DAYS_TO_LOAD : null,+ dayCount: BOOKER_NUMBER_OF_DAYS_TO_LOAD > 0 ? BOOKER_NUMBER_OF_DAYS_TO_LOAD : null,setDayCount: (dayCount: number | null) => {set({ dayCount });},@@ -644,9 +621,7 @@ export const createBookerStore = () =>// Preselect today's date in week / column view, since they use this to show the week title.selectedDate:selectedDateInStore ||- (["week_view", "column_view"].includes(layout)- ? dayjs().format("YYYY-MM-DD")- : null),+ (["week_view", "column_view"].includes(layout) ? dayjs().format("YYYY-MM-DD") : null),teamMemberEmail,crmOwnerRecordType,crmAppSlug,@@ -707,24 +682,14 @@ export const createBookerStore = () =>set({ rescheduleUid });},recurringEventCount: null,- setRecurringEventCount: (recurringEventCount: number | null) =>- set({ recurringEventCount }),- recurringEventCountQueryParam:- Number(getQueryParam("recurringEventCount")) || null,- setRecurringEventCountQueryParam: (- recurringEventCountQueryParam: number | null- ) => {+ setRecurringEventCount: (recurringEventCount: number | null) => set({ recurringEventCount }),+ recurringEventCountQueryParam: Number(getQueryParam("recurringEventCount")) || null,+ setRecurringEventCountQueryParam: (recurringEventCountQueryParam: number | null) => {// Guard: only update state if value is valid (not NaN or null)- if (- recurringEventCountQueryParam !== null &&- !isNaN(recurringEventCountQueryParam)- ) {+ if (recurringEventCountQueryParam !== null && !isNaN(recurringEventCountQueryParam)) {set({ recurringEventCountQueryParam });if (!get().isPlatform || get().allowUpdatingUrlParams) {- updateQueryParam(- "recurringEventCount",- recurringEventCountQueryParam- );+ updateQueryParam("recurringEventCount", recurringEventCountQueryParam);}}// If invalid, don't update state or URL - just ignore the call@@ -755,9 +720,7 @@ export const createBookerStore = () =>allowUpdatingUrlParams: true,defaultPhoneCountry: null,isSlotSelectionModalVisible: false,- setIsSlotSelectionModalVisible: (- isSlotSelectionModalVisible: boolean- ) => {+ setIsSlotSelectionModalVisible: (isSlotSelectionModalVisible: boolean) => {set({ isSlotSelectionModalVisible });},}));diff --git a/packages/features/bookings/Booker/utils/dates.tsx b/packages/features/bookings/Booker/utils/dates.tsxindex d7d7b9e6668..64f65c53d9e 100644--- a/packages/features/bookings/Booker/utils/dates.tsx+++ b/packages/features/bookings/Booker/utils/dates.tsx@@ -34,10 +34,7 @@ export const formatEventFromTime = ({ date, timeFormat, timeZone, language }: Evreturn {date: formattedDate,- time:- timeFormat === TimeFormat.TWELVE_HOUR- ? formattedTime.toLowerCase()- : formattedTime,+ time: timeFormat === TimeFormat.TWELVE_HOUR ? formattedTime.toLowerCase() : formattedTime,};};@@ -68,10 +65,7 @@ export const formatEventFromToTime = ({return {date: formattedDate,- time:- timeFormat === TimeFormat.TWELVE_HOUR- ? formattedTime.toLowerCase()- : formattedTime,+ time: timeFormat === TimeFormat.TWELVE_HOUR ? formattedTime.toLowerCase() : formattedTime,};};diff --git a/packages/features/bookings/Booker/utils/getPrefetchMonthCount.test.ts b/packages/features/bookings/Booker/utils/getPrefetchMonthCount.test.tsindex 2db3076a28a..77bd38595be 100644--- a/packages/features/bookings/Booker/utils/getPrefetchMonthCount.test.ts+++ b/packages/features/bookings/Booker/utils/getPrefetchMonthCount.test.ts@@ -84,7 +84,13 @@ describe("getPrefetchMonthCount", () => {});it("should return undefined when both months are invalid", () => {- const result = getPrefetchMonthCount(BookerLayouts.COLUMN_VIEW, "selecting_time", Infinity, -Infinity, false);+ const result = getPrefetchMonthCount(+ BookerLayouts.COLUMN_VIEW,+ "selecting_time",+ Infinity,+ -Infinity,+ false+ );expect(result).toBe(undefined);});});diff --git a/packages/features/bookings/di/BookingEventHandlerService.container.ts b/packages/features/bookings/di/BookingEventHandlerService.container.tsindex c8b542287db..5a1df5dd785 100644--- a/packages/features/bookings/di/BookingEventHandlerService.container.ts+++ b/packages/features/bookings/di/BookingEventHandlerService.container.ts@@ -12,4 +12,3 @@ export function getBookingEventHandlerService() {return container.get<BookingEventHandlerService>(bookingEventHandlerServiceModule.token);}-diff --git a/packages/features/bookings/lib/EventManager.ts b/packages/features/bookings/lib/EventManager.tsindex 16338834065..3668cafbd44 100644--- a/packages/features/bookings/lib/EventManager.ts+++ b/packages/features/bookings/lib/EventManager.ts@@ -399,7 +399,7 @@ export default class EventManager {return {type: result.type,- uid: createdEventObj ? createdEventObj.id : result.createdEvent?.id?.toString() ?? "",+ uid: createdEventObj ? createdEventObj.id : (result.createdEvent?.id?.toString() ?? ""),thirdPartyRecurringEventId: isCalendarType ? thirdPartyRecurringEventId : undefined,meetingId: createdEventObj ? createdEventObj.id : result.createdEvent?.id?.toString(),meetingPassword: createdEventObj ? createdEventObj.password : result.createdEvent?.password,@@ -688,9 +688,7 @@ export default class EventManager {if (evt.requiresConfirmation) {if (!skipDeleteEventsAndMeetings) {- log.debug(- "RescheduleRequiresConfirmation: Deleting Event and Meeting for previous booking"- );+ log.debug("RescheduleRequiresConfirmation: Deleting Event and Meeting for previous booking");// As the reschedule requires confirmation, we can't update the events and meetings to new time yet. So, just delete them and let it be handled when organizer confirms the booking.await this.deleteEventsAndMeetings({event: {diff --git a/packages/features/bookings/lib/buildEventUrlFromBooking.ts b/packages/features/bookings/lib/buildEventUrlFromBooking.tsindex cf5e3754856..24c757f17ca 100644--- a/packages/features/bookings/lib/buildEventUrlFromBooking.ts+++ b/packages/features/bookings/lib/buildEventUrlFromBooking.ts@@ -24,7 +24,7 @@ export function getOrganizationIdOfBooking(booking: {const { eventType, profileEnrichedBookingUser } = booking;return eventType.team? eventType.team.parentId- : profileEnrichedBookingUser?.profile.organizationId ?? null;+ : (profileEnrichedBookingUser?.profile.organizationId ?? null);}export async function buildEventUrlFromBooking(booking: {diff --git a/packages/features/bookings/lib/get-booking.ts b/packages/features/bookings/lib/get-booking.tsindex 5f4b71e48a5..14f17dcfc19 100644--- a/packages/features/bookings/lib/get-booking.ts+++ b/packages/features/bookings/lib/get-booking.ts@@ -26,8 +26,7 @@ function getResponsesFromOldBooking() {const customInputs = rawBooking.customInputs || {};const responses = Object.keys(customInputs).reduce((acc, label) => {- acc[slugify(label) as keyof typeof acc] =- customInputs[label as keyof typeof customInputs];+ acc[slugify(label) as keyof typeof acc] = customInputs[label as keyof typeof customInputs];return acc;}, {});return {@@ -46,11 +45,7 @@ function getResponsesFromOldBooking(};}-async function getBooking(- prisma: PrismaClient,- uid: string,- isSeatedEvent?: boolean-) {+async function getBooking(prisma: PrismaClient, uid: string, isSeatedEvent?: boolean) {const rawBooking = await prisma.booking.findUnique({where: {uid,@@ -102,12 +97,8 @@ async function getBooking(if (booking) {// @NOTE: had to do this because Server side cant return [Object objects]// probably fixable with json.stringify -> json.parse- booking["startTime"] = (- booking?.startTime as Date- )?.toISOString() as unknown as Date;- booking["endTime"] = (- booking?.endTime as Date- )?.toISOString() as unknown as Date;+ booking["startTime"] = (booking?.startTime as Date)?.toISOString() as unknown as Date;+ booking["endTime"] = (booking?.endTime as Date)?.toISOString() as unknown as Date;}return booking;@@ -120,16 +111,14 @@ export const getBookingWithResponses = <select: BookingSelect & {responses: true;};- }>+ }>,>(booking: T,isSeatedEvent?: boolean) => {return {...booking,- responses: isSeatedEvent- ? booking.responses- : booking.responses || getResponsesFromOldBooking(booking),+ responses: isSeatedEvent ? booking.responses : booking.responses || getResponsesFromOldBooking(booking),} as Omit<T, "responses"> & { responses: Record<string, any> };};@@ -211,16 +200,10 @@ export const getBookingForReschedule = async (uid: string, userId?: number) => {// If we have the booking and not bookingSeat, we need to make sure the booking belongs to the userLoggedIn// Otherwise, we return null here.let hasOwnershipOnBooking = false;- if (- theBooking &&- theBooking?.eventType?.seatsPerTimeSlot &&- bookingSeatReferenceUid === null- ) {+ if (theBooking && theBooking?.eventType?.seatsPerTimeSlot && bookingSeatReferenceUid === null) {const isOwnerOfBooking = theBooking.userId === userId;- const isHostOfEventType = theBooking?.eventType?.hosts.some(- (host) => host.userId === userId- );+ const isHostOfEventType = theBooking?.eventType?.hosts.some((host) => host.userId === userId);const isUserIdInBooking = theBooking.userId === userId;@@ -235,13 +218,7 @@ export const getBookingForReschedule = async (uid: string, userId?: number) => {});}- if (- !isOwnerOfBooking &&- !isHostOfEventType &&- !isUserIdInBooking &&- !hasOrgAccess- )- return null;+ if (!isOwnerOfBooking && !isHostOfEventType && !isUserIdInBooking && !hasOrgAccess) return null;hasOwnershipOnBooking = true;}@@ -249,27 +226,21 @@ export const getBookingForReschedule = async (uid: string, userId?: number) => {// and we return null here.if (!theBooking && !rescheduleUid) return null;- const booking = await getBooking(- prisma,- rescheduleUid || uid,- bookingSeatReferenceUid ? true : false- );+ const booking = await getBooking(prisma, rescheduleUid || uid, bookingSeatReferenceUid ? true : false);if (!booking) return null;if (bookingSeatReferenceUid) {booking["description"] = bookingSeatData?.description ?? null;- booking["responses"] = bookingResponsesDbSchema.parse(- bookingSeatData?.responses ?? {}- );+ booking["responses"] = bookingResponsesDbSchema.parse(bookingSeatData?.responses ?? {});}return {...booking,attendees: rescheduleUid? booking.attendees.filter((attendee) => attendee.email === attendeeEmail): hasOwnershipOnBooking- ? []- : booking.attendees,+ ? []+ : booking.attendees,};};@@ -349,7 +320,6 @@ export const getMultipleDurationValue = (defaultValue: number) => {if (!multipleDurationConfig) return null;- if (multipleDurationConfig.includes(Number(queryDuration)))- return Number(queryDuration);+ if (multipleDurationConfig.includes(Number(queryDuration))) return Number(queryDuration);return defaultValue;};diff --git a/packages/features/bookings/lib/getAllCredentialsForUsersOnEvent/getAllCredentials.test.ts b/packages/features/bookings/lib/getAllCredentialsForUsersOnEvent/getAllCredentials.test.tsindex e8ccf58b098..3d6e48722b4 100644--- a/packages/features/bookings/lib/getAllCredentialsForUsersOnEvent/getAllCredentials.test.ts+++ b/packages/features/bookings/lib/getAllCredentialsForUsersOnEvent/getAllCredentials.test.ts@@ -11,9 +11,11 @@ import { UserRepository } from "@calcom/features/users/repositories/UserRepositovi.mock("@calcom/features/users/repositories/UserRepository", () => {return {- UserRepository: vi.fn().mockImplementation(function() { return {- enrichUserWithItsProfile: vi.fn(),- }; }),+ UserRepository: vi.fn().mockImplementation(function () {+ return {+ enrichUserWithItsProfile: vi.fn(),+ };+ }),};});diff --git a/packages/features/bookings/lib/getAllCredentialsForUsersOnEvent/getAllCredentials.ts b/packages/features/bookings/lib/getAllCredentialsForUsersOnEvent/getAllCredentials.tsindex 46cb8f8a09a..a9d0961fd00 100644--- a/packages/features/bookings/lib/getAllCredentialsForUsersOnEvent/getAllCredentials.ts+++ b/packages/features/bookings/lib/getAllCredentialsForUsersOnEvent/getAllCredentials.ts@@ -24,7 +24,7 @@ export const getAllCredentialsIncludeServiceAccountKey = async (eventType: EventType) => {let allCredentials = Array.isArray(user.credentials) ? user.credentials : [];-+if (eventType?.team?.id) {const teamCredentialsQuery = await prisma.credential.findMany({where: {@@ -33,10 +33,10 @@ export const getAllCredentialsIncludeServiceAccountKey = async (select: credentialForCalendarServiceSelect,});if (Array.isArray(teamCredentialsQuery)) {- allCredentials.push(...teamCredentialsQuery);+ allCredentials.push(...teamCredentialsQuery);}}-+if (eventType?.parentId) {const teamCredentialsQuery = await prisma.team.findFirst({where: {@@ -60,7 +60,7 @@ export const getAllCredentialsIncludeServiceAccountKey = async (const { profile } = await new UserRepository(prisma).enrichUserWithItsProfile({user: user,});-+if (profile?.organizationId) {const org = await prisma.team.findUnique({where: {diff --git a/packages/features/bookings/lib/getAssignmentReasonCategory.test.ts b/packages/features/bookings/lib/getAssignmentReasonCategory.test.tsindex 423de32c053..27dfa5b2b0a 100644--- a/packages/features/bookings/lib/getAssignmentReasonCategory.test.ts+++ b/packages/features/bookings/lib/getAssignmentReasonCategory.test.ts@@ -26,7 +26,9 @@ describe("getAssignmentReasonCategory", () => {});it("returns 'salesforce_assigned' for SALESFORCE_ASSIGNMENT", () => {- expect(getAssignmentReasonCategory(AssignmentReasonEnum.SALESFORCE_ASSIGNMENT)).toBe("salesforce_assigned");+ expect(getAssignmentReasonCategory(AssignmentReasonEnum.SALESFORCE_ASSIGNMENT)).toBe(+ "salesforce_assigned"+ );});it("returns 'routed' for unknown enum values (default case)", () => {diff --git a/packages/features/bookings/lib/getBookingFields.ts b/packages/features/bookings/lib/getBookingFields.tsindex b572cb797c3..59a9e4bdd7c 100644--- a/packages/features/bookings/lib/getBookingFields.ts+++ b/packages/features/bookings/lib/getBookingFields.ts@@ -36,7 +36,7 @@ export const getSmsReminderNumberField = () =>defaultLabel: "number_text_notifications",defaultPlaceholder: "enter_phone_number",editable: "system",- } as const);+ }) as const;export const getSmsReminderNumberSource = ({workflowId,@@ -59,7 +59,7 @@ export const getAIAgentCallPhoneNumberField = () =>defaultLabel: "phone_number_for_ai_call",defaultPlaceholder: "enter_phone_number",editable: "system",- } as const);+ }) as const;export const getAIAgentCallPhoneNumberSource = ({workflowId,diff --git a/packages/features/bookings/lib/getBookingResponsesSchema.test.ts b/packages/features/bookings/lib/getBookingResponsesSchema.test.tsindex dde596199ff..a96f65b21a6 100644--- a/packages/features/bookings/lib/getBookingResponsesSchema.test.ts+++ b/packages/features/bookings/lib/getBookingResponsesSchema.test.ts@@ -1876,7 +1876,7 @@ describe("require email/domain validation", () => {] as z.infer<typeof eventTypeBookingFields> & z.BRAND<"HAS_SYSTEM_FIELDS">,view: "ALL_VIEWS",});-+const parsedResponses = await schema.safeParseAsync({name: "John Doe",email: "[email protected]",diff --git a/packages/features/bookings/lib/getBookingResponsesSchema.ts b/packages/features/bookings/lib/getBookingResponsesSchema.tsindex d9fff695308..8f06060bc24 100644--- a/packages/features/bookings/lib/getBookingResponsesSchema.ts+++ b/packages/features/bookings/lib/getBookingResponsesSchema.ts@@ -6,19 +6,11 @@ import { fieldTypesSchemaMap } from "@calcom/features/form-builder/schema";import { dbReadResponseSchema } from "@calcom/lib/dbReadResponseSchema";import logger from "@calcom/lib/logger";import type { eventTypeBookingFields } from "@calcom/prisma/zod-utils";-import {- bookingResponses,- emailSchemaRefinement,-} from "@calcom/prisma/zod-utils";+import { bookingResponses, emailSchemaRefinement } from "@calcom/prisma/zod-utils";type View = ALL_VIEWS | (string & {});-type BookingFields =- | (z.infer<typeof eventTypeBookingFields> & z.BRAND<"HAS_SYSTEM_FIELDS">)- | null;-type TranslationFunction = (- key: string,- options?: Record<string, unknown>-) => string;+type BookingFields = (z.infer<typeof eventTypeBookingFields> & z.BRAND<"HAS_SYSTEM_FIELDS">) | null;+type TranslationFunction = (key: string, options?: Record<string, unknown>) => string;type CommonParams = {bookingFields: BookingFields;view: View;@@ -58,11 +50,7 @@ const doesEmailMatchEntry = (bookerEmail: string, entry: string): boolean => {return bookerEmailLower.endsWith("@" + entry.toLowerCase());};-export const getBookingResponsesPartialSchema = ({- bookingFields,- view,- translateFn,-}: CommonParams) => {+export const getBookingResponsesPartialSchema = ({ bookingFields, view, translateFn }: CommonParams) => {const schema = bookingResponses.unwrap().partial().and(catchAllSchema);return preprocess({@@ -77,11 +65,7 @@ export const getBookingResponsesPartialSchema = ({// Should be used when we know that not all fields responses are present// - Can happen when we are parsing the prefill query string// - Can happen when we are parsing a booking's responses (which was created before we added a new required field)-export default function getBookingResponsesSchema({- bookingFields,- view,- translateFn,-}: CommonParams) {+export default function getBookingResponsesSchema({ bookingFields, view, translateFn }: CommonParams) {const schema = bookingResponses.and(z.record(z.any()));return preprocess({schema,@@ -129,8 +113,7 @@ function preprocess<T extends z.ZodType>({const log = logger.getSubLogger({ prefix: ["getBookingResponsesSchema"] });const preprocessed = z.preprocess((responses) => {- const parsedResponses =- z.record(z.any()).nullable().parse(responses) || {};+ const parsedResponses = z.record(z.any()).nullable().parse(responses) || {};const newResponses = {} as typeof parsedResponses;// if eventType has been deleted, we won't have bookingFields and thus we can't preprocess or validate them.if (!bookingFields) return parsedResponses;@@ -142,17 +125,12 @@ function preprocess<T extends z.ZodType>({}const views = field.views;const isFieldApplicableToCurrentView =- currentView === "ALL_VIEWS"- ? true- : views- ? views.find((view) => view.id === currentView)- : true;+ currentView === "ALL_VIEWS" ? true : views ? views.find((view) => view.id === currentView) : true;if (!isFieldApplicableToCurrentView) {// If the field is not applicable in the current view, then we don't need to do any processingreturn;}- const fieldTypeSchema =- fieldTypesSchemaMap[field.type as keyof typeof fieldTypesSchemaMap];+ const fieldTypeSchema = fieldTypesSchemaMap[field.type as keyof typeof fieldTypesSchemaMap];// TODO: Move all the schemas along with their respective types to fieldTypeSchema, that would make schemas shared across Routing Forms builder and Booking Question Formm builderif (fieldTypeSchema) {newResponses[field.name] = fieldTypeSchema.preprocess({@@ -167,11 +145,7 @@ function preprocess<T extends z.ZodType>({newResponses[field.name] = value === "true" || value === true;}// Make sure that the value is an array- else if (- field.type === "multiemail" ||- field.type === "checkbox" ||- field.type === "multiselect"- ) {+ else if (field.type === "multiemail" || field.type === "checkbox" || field.type === "multiselect") {newResponses[field.name] = value instanceof Array ? value : [value];}// Parse JSON@@ -183,17 +157,12 @@ function preprocess<T extends z.ZodType>({try {parsedValue = JSON.parse(value);} catch (e) {- log.error(- `Failed to parse JSON for field ${field.name}`,- e- );+ log.error(`Failed to parse JSON for field ${field.name}`, e);}const optionsInputs = field.optionsInputs;const optionInputField = optionsInputs?.[parsedValue.value];if (optionInputField && optionInputField.type === "phone") {- parsedValue.optionValue = ensureValidPhoneNumber(- parsedValue.optionValue- );+ parsedValue.optionValue = ensureValidPhoneNumber(parsedValue.optionValue);}newResponses[field.name] = parsedValue;} else if (field.type === "phone") {@@ -214,9 +183,7 @@ function preprocess<T extends z.ZodType>({return;}- const attendeePhoneNumberField = bookingFields.find(- (field) => field.name === "attendeePhoneNumber"- );+ const attendeePhoneNumberField = bookingFields.find((field) => field.name === "attendeePhoneNumber");const isAttendeePhoneNumberFieldHidden = attendeePhoneNumberField?.hidden;const emailField = bookingFields.find((field) => field.name === "email");@@ -230,9 +197,7 @@ function preprocess<T extends z.ZodType>({for (const bookingField of bookingFields) {const value = responses[bookingField.name];const stringSchema = z.string();- const emailSchema = isPartialSchema- ? z.string()- : z.string().refine(emailSchemaRefinement);+ const emailSchema = isPartialSchema ? z.string() : z.string().refine(emailSchemaRefinement);const phoneSchema = isPartialSchema? z.string(): z.string().refine(async (val) => {@@ -240,18 +205,12 @@ function preprocess<T extends z.ZodType>({});// Tag the message with the input name so that the message can be shown at appropriate placeconst m = (message: string, options?: Record<string, unknown>) => {- const translatedMessage = translateFn- ? translateFn(message, options)- : message;+ const translatedMessage = translateFn ? translateFn(message, options) : message;return `{${bookingField.name}}${translatedMessage}`;};const views = bookingField.views;const isFieldApplicableToCurrentView =- currentView === "ALL_VIEWS"- ? true- : views- ? views.find((view) => view.id === currentView)- : true;+ currentView === "ALL_VIEWS" ? true : views ? views.find((view) => view.id === currentView) : true;let hidden = bookingField.hidden;const numOptions = bookingField.options?.length ?? 0;if (bookingField.hideWhenJustOneOption) {@@ -276,10 +235,7 @@ function preprocess<T extends z.ZodType>({}if (bookingField.type === "email") {- if (- !bookingField.hidden &&- (isRequired || (value && value.trim() !== ""))- ) {+ if (!bookingField.hidden && (isRequired || (value && value.trim() !== ""))) {// Email RegExp to validate if the input is a valid emailif (!emailSchema.safeParse(value).success) {ctx.addIssue({@@ -292,9 +248,7 @@ function preprocess<T extends z.ZodType>({if (value) {const bookerEmail = value;const excludedEmails =- bookingField.excludeEmails- ?.split(",")- .map((domain) => domain.trim()) || [];+ bookingField.excludeEmails?.split(",").map((domain) => domain.trim()) || [];const match = excludedEmails.find((excludedEntry) =>doesEmailMatchEntry(bookerEmail, excludedEntry)@@ -325,10 +279,7 @@ function preprocess<T extends z.ZodType>({continue;}- const fieldTypeSchema =- fieldTypesSchemaMap[- bookingField.type as keyof typeof fieldTypesSchemaMap- ];+ const fieldTypeSchema = fieldTypesSchemaMap[bookingField.type as keyof typeof fieldTypesSchemaMap];if (fieldTypeSchema) {fieldTypeSchema.superRefine({@@ -354,10 +305,7 @@ function preprocess<T extends z.ZodType>({if (!emailsParsed.success) {// If additional guests are shown but all inputs are empty then don't show any errors- if (- bookingField.name === "guests" &&- value.every((email: string) => email === "")- ) {+ if (bookingField.name === "guests" && value.every((email: string) => email === "")) {// reset guests to empty array, otherwise it adds "" for every inputresponses[bookingField.name] = [];continue;@@ -443,9 +391,7 @@ function preprocess<T extends z.ZodType>({const typeOfOptionInput = optionField?.type;if (// Either the field is required or there is a radio selected, we need to check if the optionInput is required or not.- (isRequired || value?.value) && checkOptional- ? true- : optionField?.required && !optionValue+ (isRequired || value?.value) && checkOptional ? true : optionField?.required && !optionValue) {ctx.addIssue({code: z.ZodIssueCode.custom,@@ -471,11 +417,7 @@ function preprocess<T extends z.ZodType>({// Use fieldTypeConfig.propsType to validate for propsType=="text" or propsType=="select" as in those cases, the response would be a string.// If say we want to do special validation for 'address' that can be added to `fieldTypesSchemaMap`- if (- ["address", "text", "select", "number", "radio", "textarea"].includes(- bookingField.type- )- ) {+ if (["address", "text", "select", "number", "radio", "textarea"].includes(bookingField.type)) {const schema = stringSchema;if (!schema.safeParse(value).success) {ctx.addIssue({@@ -496,10 +438,7 @@ function preprocess<T extends z.ZodType>({if (isPartialSchema) {// Query Params can be completely invalid, try to preprocess as much of it in correct format but in worst case simply don't prefill instead of crashingreturn preprocessed.catch(function (res?: { error?: unknown[] }) {- console.error(- "Failed to preprocess query params, prefilling will be skipped",- res?.error- );+ console.error("Failed to preprocess query params, prefilling will be skipped", res?.error);return {};});}diff --git a/packages/features/bookings/lib/getHostsAndGuests.ts b/packages/features/bookings/lib/getHostsAndGuests.tsindex 1b1dd225990..c37aa7dd406 100644--- a/packages/features/bookings/lib/getHostsAndGuests.ts+++ b/packages/features/bookings/lib/getHostsAndGuests.ts@@ -40,10 +40,12 @@ export function getHostsAndGuests(booking: BookingInput): { hosts: Host[]; guestconst hostEmails = new Set(filteredHosts.map((host) => host.email));const guests =- booking.attendees?.filter((attendee) => !hostEmails.has(attendee.email)).map((attendee) => ({- email: attendee.email,- name: attendee.name,- })) ?? [];+ booking.attendees+ ?.filter((attendee) => !hostEmails.has(attendee.email))+ .map((attendee) => ({+ email: attendee.email,+ name: attendee.name,+ })) ?? [];return {hosts: filteredHosts,diff --git a/packages/features/bookings/lib/getLuckyUser.ts b/packages/features/bookings/lib/getLuckyUser.tsindex 45d91bd9e4c..6c60fe77843 100644--- a/packages/features/bookings/lib/getLuckyUser.ts+++ b/packages/features/bookings/lib/getLuckyUser.ts@@ -370,7 +370,7 @@ export class LuckyUserService implements ILuckyUserService {private filterUsersBasedOnWeights<T extends PartialUser & {weight?: number | null;- }+ },>({availableUsers,bookingsOfAvailableUsersOfInterval,@@ -493,7 +493,7 @@ export class LuckyUserService implements ILuckyUserService {T extends PartialUser & {priority?: number | null;weight?: number | null;- }+ },>(allRRHosts: GetLuckyUserParams<T>["allRRHosts"],attributesQueryValueChild: Record<@@ -693,15 +693,18 @@ export class LuckyUserService implements ILuckyUserService {));- return usersBusyTimesQuery.reduce((usersBusyTime, userBusyTimeQuery, index) => {- if (userBusyTimeQuery.success) {- usersBusyTime.push({- userId: usersWithCredentials[index].id,- busyTimes: userBusyTimeQuery.data,- });- }- return usersBusyTime;- }, [] as { userId: number; busyTimes: Awaited<ReturnType<typeof getBusyCalendarTimes>>["data"] }[]);+ return usersBusyTimesQuery.reduce(+ (usersBusyTime, userBusyTimeQuery, index) => {+ if (userBusyTimeQuery.success) {+ usersBusyTime.push({+ userId: usersWithCredentials[index].id,+ busyTimes: userBusyTimeQuery.data,+ });+ }+ return usersBusyTime;+ },+ [] as { userId: number; busyTimes: Awaited<ReturnType<typeof getBusyCalendarTimes>>["data"] }[]+ );}private async getBookingsOfInterval({@@ -736,7 +739,7 @@ export class LuckyUserService implements ILuckyUserService {T extends PartialUser & {priority?: number | null;weight?: number | null;- }+ },>(getLuckyUserParams: GetLuckyUserParams<T>): Promise<FetchedData> {const startTime = performance.now();@@ -763,9 +766,8 @@ export class LuckyUserService implements ILuckyUserService {);})();- const { attributeWeights, virtualQueuesData } = await this.prepareQueuesAndAttributesData(- getLuckyUserParams- );+ const { attributeWeights, virtualQueuesData } =+ await this.prepareQueuesAndAttributesData(getLuckyUserParams);const interval =eventType.isRRWeightsEnabled && getLuckyUserParams.eventType.team?.rrResetInterval@@ -917,7 +919,7 @@ export class LuckyUserService implements ILuckyUserService {T extends PartialUser & {priority?: number | null;weight?: number | null;- }+ },>(getLuckyUserParams: GetLuckyUserParams<T>) {// Early return if only one available user to avoid unnecessary data fetchingif (getLuckyUserParams.availableUsers.length === 1) {@@ -938,7 +940,7 @@ export class LuckyUserService implements ILuckyUserService {T extends PartialUser & {priority?: number | null;weight?: number | null;- }+ },>({ availableUsers, ...getLuckyUserParams }: GetLuckyUserParams<T> & FetchedData) {const {eventType,diff --git a/packages/features/bookings/lib/handleNewBooking/createBooking.ts b/packages/features/bookings/lib/handleNewBooking/createBooking.tsindex e33790cec9d..5c8011d4d6f 100644--- a/packages/features/bookings/lib/handleNewBooking/createBooking.ts+++ b/packages/features/bookings/lib/handleNewBooking/createBooking.ts@@ -143,7 +143,14 @@ async function saveBooking(const createBookingObj = {include: {user: {- select: { uuid: true, email: true, name: true, timeZone: true, username: true, isPlatformManaged: true },+ select: {+ uuid: true,+ email: true,+ name: true,+ timeZone: true,+ username: true,+ isPlatformManaged: true,+ },},attendees: true,payment: true,@@ -258,8 +265,8 @@ function buildNewBookingData(params: CreateBookingParams) {destinationCalendar:evt.destinationCalendar && evt.destinationCalendar.length > 0? {- connect: { id: evt.destinationCalendar[0].id },- }+ connect: { id: evt.destinationCalendar[0].id },+ }: undefined,routedFromRoutingFormReponse: routingFormResponseIddiff --git a/packages/features/bookings/lib/handleNewBooking/getAuditActionSource.ts b/packages/features/bookings/lib/handleNewBooking/getAuditActionSource.tsindex c61e0d37dbf..5b327d1d889 100644--- a/packages/features/bookings/lib/handleNewBooking/getAuditActionSource.ts+++ b/packages/features/bookings/lib/handleNewBooking/getAuditActionSource.ts@@ -2,14 +2,26 @@ import { CreationSource } from "@calcom/prisma/enums";import type { ActionSource } from "@calcom/features/booking-audit/lib/types/actionSource";import { criticalLogger } from "@calcom/lib/logger.server";-export const getAuditActionSource = ({ creationSource, eventTypeId, rescheduleUid }: { creationSource: CreationSource | null | undefined, eventTypeId: number, rescheduleUid: string | null }): ActionSource => {- if (creationSource === CreationSource.API_V1 || creationSource === CreationSource.API_V2 || creationSource === CreationSource.WEBAPP) {- return creationSource;- }- // Unknown creationSource - log for tracking and fix- criticalLogger.warn("Unknown booking creationSource detected", {- eventTypeId,- rescheduleUid,- });- return "UNKNOWN";-};\ No newline at end of file+export const getAuditActionSource = ({+ creationSource,+ eventTypeId,+ rescheduleUid,+}: {+ creationSource: CreationSource | null | undefined;+ eventTypeId: number;+ rescheduleUid: string | null;+}): ActionSource => {+ if (+ creationSource === CreationSource.API_V1 ||+ creationSource === CreationSource.API_V2 ||+ creationSource === CreationSource.WEBAPP+ ) {+ return creationSource;+ }+ // Unknown creationSource - log for tracking and fix+ criticalLogger.warn("Unknown booking creationSource detected", {+ eventTypeId,+ rescheduleUid,+ });+ return "UNKNOWN";+};diff --git a/packages/features/bookings/lib/handleNewBooking/getCustomInputsResponses.ts b/packages/features/bookings/lib/handleNewBooking/getCustomInputsResponses.tsindex c790836ebe6..1c9df0c727b 100644--- a/packages/features/bookings/lib/handleNewBooking/getCustomInputsResponses.ts+++ b/packages/features/bookings/lib/handleNewBooking/getCustomInputsResponses.ts@@ -16,10 +16,13 @@ type RequestBody = {function mapCustomInputs(customInputs: { label: string; value: CustomInputs[number]["value"] }[]): Record<string, CustomInputs[number]["value"]> {- return customInputs.reduce((acc, { label, value }) => {- acc[label] = value;- return acc;- }, {} as Record<string, CustomInputs[number]["value"]>);+ return customInputs.reduce(+ (acc, { label, value }) => {+ acc[label] = value;+ return acc;+ },+ {} as Record<string, CustomInputs[number]["value"]>+ );}function mapResponsesToCustomInputs(@@ -27,13 +30,16 @@ function mapResponsesToCustomInputs(eventTypeCustomInputs: getEventTypeResponse["customInputs"]): NonNullable<CalendarEvent["customInputs"]> {// Backward Compatibility: Map new `responses` to old `customInputs` format so that webhooks can still receive same values.- return Object.entries(responses).reduce((acc, [fieldName, fieldValue]) => {- const foundInput = eventTypeCustomInputs.find((input) => slugify(input.label) === fieldName);- if (foundInput) {- acc[foundInput.label] = fieldValue;- }- return acc;- }, {} as NonNullable<CalendarEvent["customInputs"]>);+ return Object.entries(responses).reduce(+ (acc, [fieldName, fieldValue]) => {+ const foundInput = eventTypeCustomInputs.find((input) => slugify(input.label) === fieldName);+ if (foundInput) {+ acc[foundInput.label] = fieldValue;+ }+ return acc;+ },+ {} as NonNullable<CalendarEvent["customInputs"]>+ );}export function getCustomInputsResponses(diff --git a/packages/features/bookings/lib/handleNewBooking/getLocationValuesForDb.ts b/packages/features/bookings/lib/handleNewBooking/getLocationValuesForDb.tsindex 743d76e30c1..0eedda6a1a9 100644--- a/packages/features/bookings/lib/handleNewBooking/getLocationValuesForDb.ts+++ b/packages/features/bookings/lib/handleNewBooking/getLocationValuesForDb.ts@@ -20,7 +20,7 @@ export const _getLocationValuesForDb = <username: string | null;metadata: Prisma.JsonValue;credentials: CredentialForCalendarService[];- }+ },>({dynamicUserList,users,diff --git a/packages/features/bookings/lib/handleNewBooking/handleAppsStatus.ts b/packages/features/bookings/lib/handleNewBooking/handleAppsStatus.tsindex b90237ca75b..c96d3719df9 100644--- a/packages/features/bookings/lib/handleNewBooking/handleAppsStatus.ts+++ b/packages/features/bookings/lib/handleNewBooking/handleAppsStatus.ts@@ -46,16 +46,19 @@ function calculateAggregatedAppsStatus(// From down here we can assume reqAppsStatus is not undefined anymore// Other status exist, so this is the last booking of a series,// proceeding to prepare the info for the event- const aggregatedStatus = reqAppsStatus.concat(resultStatus).reduce((acc, curr) => {- if (acc[curr.type]) {- acc[curr.type].success += curr.success;- acc[curr.type].errors = acc[curr.type].errors.concat(curr.errors);- acc[curr.type].warnings = acc[curr.type].warnings?.concat(curr.warnings || []);- } else {- acc[curr.type] = curr;- }- return acc;- }, {} as { [key: string]: AppsStatus });+ const aggregatedStatus = reqAppsStatus.concat(resultStatus).reduce(+ (acc, curr) => {+ if (acc[curr.type]) {+ acc[curr.type].success += curr.success;+ acc[curr.type].errors = acc[curr.type].errors.concat(curr.errors);+ acc[curr.type].warnings = acc[curr.type].warnings?.concat(curr.warnings || []);+ } else {+ acc[curr.type] = curr;+ }+ return acc;+ },+ {} as { [key: string]: AppsStatus }+ );return Object.values(aggregatedStatus);}diff --git a/packages/features/bookings/lib/handleNewBooking/test/buildEventForTeamEventType.test.ts b/packages/features/bookings/lib/handleNewBooking/test/buildEventForTeamEventType.test.tsindex d61f58c2673..1a8b6e68e6c 100644--- a/packages/features/bookings/lib/handleNewBooking/test/buildEventForTeamEventType.test.ts+++ b/packages/features/bookings/lib/handleNewBooking/test/buildEventForTeamEventType.test.ts@@ -25,7 +25,7 @@ vi.mock("@calcom/features/CalendarEventBuilder", () => {fromEvent: vi.fn().mockImplementation((_evt) => ({withDestinationCalendar: withDestinationCalendarSpy,withTeam: withTeamSpy,- build: vi.fn().mockImplementation(function() {+ build: vi.fn().mockImplementation(function () {return {destinationCalendar: [],team: {}, // <- you won't use this result anywaydiff --git a/packages/features/bookings/lib/handleNewBooking/test/fresh-booking.test.ts b/packages/features/bookings/lib/handleNewBooking/test/fresh-booking.test.tsindex 7b71cd8e500..8ee00d1d735 100644--- a/packages/features/bookings/lib/handleNewBooking/test/fresh-booking.test.ts+++ b/packages/features/bookings/lib/handleNewBooking/test/fresh-booking.test.ts@@ -88,7 +88,10 @@ async function mockPaymentSuccessWebhookFromStripe({ externalId }: { externalId:let webhookResponse = null;try {const traceContext = distributedTracing.createTrace("test_stripe_webhook");- await handleStripePaymentSuccess(getMockedStripePaymentEvent({ paymentIntentId: externalId }), traceContext);+ await handleStripePaymentSuccess(+ getMockedStripePaymentEvent({ paymentIntentId: externalId }),+ traceContext+ );} catch (e) {log.silly("mockPaymentSuccessWebhookFromStripe:catch", JSON.stringify(e));webhookResponse = e as HttpError;@@ -1392,7 +1395,11 @@ describe("handleNewBooking", () => {},],organizer,- apps: [TestData.apps["google-meet"], TestData.apps["daily-video"], TestData.apps["office365-calendar"]],+ apps: [+ TestData.apps["google-meet"],+ TestData.apps["daily-video"],+ TestData.apps["office365-calendar"],+ ],});mockSuccessfulVideoMeetingCreation({@@ -1481,7 +1488,11 @@ describe("handleNewBooking", () => {},],organizer,- apps: [TestData.apps["google-calendar"], TestData.apps["google-meet"], TestData.apps["daily-video"]],+ apps: [+ TestData.apps["google-calendar"],+ TestData.apps["google-meet"],+ TestData.apps["daily-video"],+ ],});mockSuccessfulVideoMeetingCreation({diff --git a/packages/features/bookings/lib/handleNewBooking/test/team-bookings/round-robin.test.ts b/packages/features/bookings/lib/handleNewBooking/test/team-bookings/round-robin.test.tsindex b4017dec064..6998a459ee5 100644--- a/packages/features/bookings/lib/handleNewBooking/test/team-bookings/round-robin.test.ts+++ b/packages/features/bookings/lib/handleNewBooking/test/team-bookings/round-robin.test.ts@@ -1089,154 +1089,151 @@ describe("Round Robin handleNewBooking", () => {});describe("Round Robin with requiresConfirmation", () => {- test(- "should not create calendar events for unconfirmed round robin bookings on first booking and reschedule",- async () => {- const handleNewBooking = getNewBookingHandler();- const booker = getBooker({- email: "[email protected]",- name: "Booker",- });-- const roundRobinHost1 = getOrganizer({- name: "RR Host 1",- email: "[email protected]",- id: 101,- schedules: [TestData.schedules.IstWorkHours],- credentials: [getGoogleCalendarCredential()],- selectedCalendars: [TestData.selectedCalendars.google],- destinationCalendar: {- integration: TestData.apps["google-calendar"].type,- externalId: "[email protected]",- },- });+ test("should not create calendar events for unconfirmed round robin bookings on first booking and reschedule", async () => {+ const handleNewBooking = getNewBookingHandler();+ const booker = getBooker({+ email: "[email protected]",+ name: "Booker",+ });- const roundRobinHost2 = getOrganizer({- name: "RR Host 2",- email: "[email protected]",- id: 102,- schedules: [TestData.schedules.IstWorkHours],- credentials: [getGoogleCalendarCredential()],- selectedCalendars: [TestData.selectedCalendars.google],- destinationCalendar: {- integration: TestData.apps["google-calendar"].type,- externalId: "[email protected]",- },- });+ const roundRobinHost1 = getOrganizer({+ name: "RR Host 1",+ email: "[email protected]",+ id: 101,+ schedules: [TestData.schedules.IstWorkHours],+ credentials: [getGoogleCalendarCredential()],+ selectedCalendars: [TestData.selectedCalendars.google],+ destinationCalendar: {+ integration: TestData.apps["google-calendar"].type,+ externalId: "[email protected]",+ },+ });++ const roundRobinHost2 = getOrganizer({+ name: "RR Host 2",+ email: "[email protected]",+ id: 102,+ schedules: [TestData.schedules.IstWorkHours],+ credentials: [getGoogleCalendarCredential()],+ selectedCalendars: [TestData.selectedCalendars.google],+ destinationCalendar: {+ integration: TestData.apps["google-calendar"].type,+ externalId: "[email protected]",+ },+ });- const { dateString: plus1DateString } = getDate({ dateIncrement: 1 });+ const { dateString: plus1DateString } = getDate({ dateIncrement: 1 });- await createBookingScenario(- getScenarioData({- eventTypes: [- {- id: 1,- slotInterval: 15,- length: 15,- requiresConfirmation: true,- schedulingType: SchedulingType.ROUND_ROBIN,- users: [- {- id: 101,- },- {- id: 102,- },- ],- hosts: [- { userId: 101, isFixed: false },- { userId: 102, isFixed: false },- ],- schedule: TestData.schedules.IstWorkHours,- },- ],- organizer: roundRobinHost1,- usersApartFromOrganizer: [roundRobinHost2],- apps: [TestData.apps["google-calendar"], TestData.apps["daily-video"]],- })- );-- // Mock calendar - we should NOT see calendar events created for unconfirmed bookings- mockCalendarToHaveNoBusySlots("googlecalendar", {- create: {- uid: "MOCK_ID",- iCalUID: "MOCKED_GOOGLE_CALENDAR_ICS_ID",- },- });-- // First booking with first host - should be PENDING and NO calendar events- const firstBookingData = getMockRequestDataForBooking({- data: {- eventTypeId: 1,- user: roundRobinHost1.name,- start: `${plus1DateString}T05:00:00.000Z`,- end: `${plus1DateString}T05:15:00.000Z`,- responses: {- email: booker.email,- name: booker.name,- location: { optionValue: "", value: BookingLocations.CalVideo },+ await createBookingScenario(+ getScenarioData({+ eventTypes: [+ {+ id: 1,+ slotInterval: 15,+ length: 15,+ requiresConfirmation: true,+ schedulingType: SchedulingType.ROUND_ROBIN,+ users: [+ {+ id: 101,+ },+ {+ id: 102,+ },+ ],+ hosts: [+ { userId: 101, isFixed: false },+ { userId: 102, isFixed: false },+ ],+ schedule: TestData.schedules.IstWorkHours,},+ ],+ organizer: roundRobinHost1,+ usersApartFromOrganizer: [roundRobinHost2],+ apps: [TestData.apps["google-calendar"], TestData.apps["daily-video"]],+ })+ );++ // Mock calendar - we should NOT see calendar events created for unconfirmed bookings+ mockCalendarToHaveNoBusySlots("googlecalendar", {+ create: {+ uid: "MOCK_ID",+ iCalUID: "MOCKED_GOOGLE_CALENDAR_ICS_ID",+ },+ });++ // First booking with first host - should be PENDING and NO calendar events+ const firstBookingData = getMockRequestDataForBooking({+ data: {+ eventTypeId: 1,+ user: roundRobinHost1.name,+ start: `${plus1DateString}T05:00:00.000Z`,+ end: `${plus1DateString}T05:15:00.000Z`,+ responses: {+ email: booker.email,+ name: booker.name,+ location: { optionValue: "", value: BookingLocations.CalVideo },},- });+ },+ });- const firstBooking = await handleNewBooking({- bookingData: firstBookingData,- });+ const firstBooking = await handleNewBooking({+ bookingData: firstBookingData,+ });- // Verify first booking is PENDING- expect(firstBooking.status).toBe(BookingStatus.PENDING);+ // Verify first booking is PENDING+ expect(firstBooking.status).toBe(BookingStatus.PENDING);- // Verify first booking has NO calendar references (no calendar events created)- const firstBookingInDb = await prisma.booking.findUnique({- where: {- id: firstBooking.id,- },- include: {- references: true,- },- });-- expect(firstBookingInDb?.references).toHaveLength(0);- expect(firstBookingInDb?.status).toBe(BookingStatus.PENDING);-- // Now reschedule with second host - should still be PENDING and NO calendar events- const rescheduleBookingData = getMockRequestDataForBooking({- data: {- eventTypeId: 1,- user: roundRobinHost2.name,- rescheduleUid: firstBooking.uid,- start: `${plus1DateString}T06:00:00.000Z`,- end: `${plus1DateString}T06:15:00.000Z`,- responses: {- email: booker.email,- name: booker.name,- location: { optionValue: "", value: BookingLocations.CalVideo },- },- rescheduledBy: booker.email,+ // Verify first booking has NO calendar references (no calendar events created)+ const firstBookingInDb = await prisma.booking.findUnique({+ where: {+ id: firstBooking.id,+ },+ include: {+ references: true,+ },+ });++ expect(firstBookingInDb?.references).toHaveLength(0);+ expect(firstBookingInDb?.status).toBe(BookingStatus.PENDING);++ // Now reschedule with second host - should still be PENDING and NO calendar events+ const rescheduleBookingData = getMockRequestDataForBooking({+ data: {+ eventTypeId: 1,+ user: roundRobinHost2.name,+ rescheduleUid: firstBooking.uid,+ start: `${plus1DateString}T06:00:00.000Z`,+ end: `${plus1DateString}T06:15:00.000Z`,+ responses: {+ email: booker.email,+ name: booker.name,+ location: { optionValue: "", value: BookingLocations.CalVideo },},- });+ rescheduledBy: booker.email,+ },+ });- const rescheduledBooking = await handleNewBooking({- bookingData: rescheduleBookingData,- });+ const rescheduledBooking = await handleNewBooking({+ bookingData: rescheduleBookingData,+ });- // Verify rescheduled booking is still PENDING- expect(rescheduledBooking.status).toBe(BookingStatus.PENDING);+ // Verify rescheduled booking is still PENDING+ expect(rescheduledBooking.status).toBe(BookingStatus.PENDING);- // Verify rescheduled booking has NO calendar references (no calendar events created)- // This is the key fix: rescheduling unconfirmed bookings should NOT create calendar events- const rescheduledBookingInDb = await prisma.booking.findUnique({- where: {- id: rescheduledBooking.id,- },- include: {- references: true,- },- });+ // Verify rescheduled booking has NO calendar references (no calendar events created)+ // This is the key fix: rescheduling unconfirmed bookings should NOT create calendar events+ const rescheduledBookingInDb = await prisma.booking.findUnique({+ where: {+ id: rescheduledBooking.id,+ },+ include: {+ references: true,+ },+ });- expect(rescheduledBookingInDb?.references).toHaveLength(0);- expect(rescheduledBookingInDb?.status).toBe(BookingStatus.PENDING);- }- );+ expect(rescheduledBookingInDb?.references).toHaveLength(0);+ expect(rescheduledBookingInDb?.status).toBe(BookingStatus.PENDING);+ });});});diff --git a/packages/features/bookings/lib/handleNewBooking/validateBookingTimeIsNotOutOfBounds.ts b/packages/features/bookings/lib/handleNewBooking/validateBookingTimeIsNotOutOfBounds.tsindex df638c2960d..5b7489d4063 100644--- a/packages/features/bookings/lib/handleNewBooking/validateBookingTimeIsNotOutOfBounds.ts+++ b/packages/features/bookings/lib/handleNewBooking/validateBookingTimeIsNotOutOfBounds.ts@@ -39,7 +39,7 @@ const _validateBookingTimeIsNotOutOfBounds = async <T extends ValidateBookingTimperiodStartDate: eventType.periodStartDate,periodCountCalendarDays: eventType.periodCountCalendarDays,bookerUtcOffset: getUTCOffsetByTimezone(reqBodyTimeZone) ?? 0,- eventUtcOffset: eventTimeZone ? getUTCOffsetByTimezone(eventTimeZone) ?? 0 : 0,+ eventUtcOffset: eventTimeZone ? (getUTCOffsetByTimezone(eventTimeZone) ?? 0) : 0,},eventType.minimumBookingNotice);diff --git a/packages/features/bookings/lib/handlePayment.ts b/packages/features/bookings/lib/handlePayment.tsindex 23bf9c51f27..c8946dc972a 100644--- a/packages/features/bookings/lib/handlePayment.ts+++ b/packages/features/bookings/lib/handlePayment.ts@@ -8,7 +8,9 @@ import type { AppCategories, Prisma, EventType } from "@calcom/prisma/client";import type { CalendarEvent } from "@calcom/types/Calendar";import type { IAbstractPaymentService } from "@calcom/types/PaymentService";-const isPaymentService = (x: unknown): x is { BuildPaymentService: (credentials: { key: unknown }) => unknown } =>+const isPaymentService = (+ x: unknown+): x is { BuildPaymentService: (credentials: { key: unknown }) => unknown } =>!!x && typeof x === "object" && "BuildPaymentService" in x && typeof x.BuildPaymentService === "function";const handlePayment = async ({@@ -141,8 +143,8 @@ const handlePayment = async ({const selectedValues = Array.isArray(responseValue)? responseValue: responseValue- ? [responseValue]- : [];+ ? [responseValue]+ : [];selectedValues.forEach((value) => {const option = typedInput.options?.find((opt) => opt.value === value);diff --git a/packages/features/bookings/lib/handleSeats/create/createNewSeat.ts b/packages/features/bookings/lib/handleSeats/create/createNewSeat.tsindex 638469a7c5f..0360b2fca01 100644--- a/packages/features/bookings/lib/handleSeats/create/createNewSeat.ts+++ b/packages/features/bookings/lib/handleSeats/create/createNewSeat.ts@@ -18,11 +18,7 @@ import { BookingStatus } from "@calcom/prisma/enums";import { findBookingQuery } from "../../handleNewBooking/findBookingQuery";import type { IEventTypePaymentCredentialType } from "../../handleNewBooking/types";-import type {- SeatedBooking,- NewSeatedBookingObject,- HandleSeatsResultBooking,-} from "../types";+import type { SeatedBooking, NewSeatedBookingObject, HandleSeatsResultBooking } from "../types";export type AddSeatInput = {bookingUid: string;@@ -48,10 +44,7 @@ export type AddSeatInput = {* Uses a transaction with a fresh read to prevent TOCTOU race conditions* where concurrent requests could exceed the seat limit.*/-export async function addSeatToBooking(- input: AddSeatInput,- prismaClient: PrismaClient = prisma-) {+export async function addSeatToBooking(input: AddSeatInput, prismaClient: PrismaClient = prisma) {const referenceUid = uuid();return prismaClient.$transaction(async (tx) => {@@ -80,9 +73,7 @@ export async function addSeatToBooking(// Check seat availability with fresh data// Only enforce the limit when seatsPerTimeSlot > 0 (matching original behavior// where falsy seatsPerTimeSlot would skip this check entirely)- const currentSeatCount = freshBooking.attendees.filter(- (attendee) => !!attendee.bookingSeat- ).length;+ const currentSeatCount = freshBooking.attendees.filter((attendee) => !!attendee.bookingSeat).length;if (input.seatsPerTimeSlot > 0 && input.seatsPerTimeSlot <= currentSeatCount) {throw new HttpError({statusCode: 409,@@ -159,9 +150,7 @@ const createNewSeat = async (};});- const videoCallReference = seatedBooking.references.find((reference) =>- reference.type.includes("_video")- );+ const videoCallReference = seatedBooking.references.find((reference) => reference.type.includes("_video"));if (videoCallReference) {evt.videoCallData = {@@ -218,20 +207,16 @@ const createNewSeat = async (let isHostConfirmationEmailsDisabled = false;let isAttendeeConfirmationEmailDisabled = false;- isHostConfirmationEmailsDisabled =- eventType.metadata?.disableStandardEmails?.confirmation?.host || false;+ isHostConfirmationEmailsDisabled = eventType.metadata?.disableStandardEmails?.confirmation?.host || false;isAttendeeConfirmationEmailDisabled =- eventType.metadata?.disableStandardEmails?.confirmation?.attendee ||- false;+ eventType.metadata?.disableStandardEmails?.confirmation?.attendee || false;if (isHostConfirmationEmailsDisabled) {- isHostConfirmationEmailsDisabled =- allowDisablingHostConfirmationEmails(workflows);+ isHostConfirmationEmailsDisabled = allowDisablingHostConfirmationEmails(workflows);}if (isAttendeeConfirmationEmailDisabled) {- isAttendeeConfirmationEmailDisabled =- allowDisablingAttendeeConfirmationEmails(workflows);+ isAttendeeConfirmationEmailDisabled = allowDisablingAttendeeConfirmationEmails(workflows);}await sendScheduledSeatsEmailsAndSMS(copyEvent,@@ -244,27 +229,16 @@ const createNewSeat = async ();}const credentials = await refreshCredentials(allCredentials);- const apps = eventTypeAppMetadataOptionalSchema.parse(- eventType?.metadata?.apps- );- const eventManager = new EventManager(- { ...organizerUser, credentials },- apps- );+ const apps = eventTypeAppMetadataOptionalSchema.parse(eventType?.metadata?.apps);+ const eventManager = new EventManager({ ...organizerUser, credentials }, apps);await eventManager.updateCalendarAttendees(evt, seatedBooking);const foundBooking = await findBookingQuery(seatedBooking.id);- if (- !Number.isNaN(paymentAppData.price) &&- paymentAppData.price > 0 &&- !!seatedBooking- ) {+ if (!Number.isNaN(paymentAppData.price) && paymentAppData.price > 0 && !!seatedBooking) {const credentialPaymentAppCategories = await prisma.credential.findMany({where: {- ...(paymentAppData.credentialId- ? { id: paymentAppData.credentialId }- : { userId: organizerUser.id }),+ ...(paymentAppData.credentialId ? { id: paymentAppData.credentialId } : { userId: organizerUser.id }),app: {categories: {hasSome: ["payment"],@@ -283,11 +257,9 @@ const createNewSeat = async (},});- const eventTypePaymentAppCredential = credentialPaymentAppCategories.find(- (credential) => {- return credential.appId === paymentAppData.appId;- }- );+ const eventTypePaymentAppCredential = credentialPaymentAppCategories.find((credential) => {+ return credential.appId === paymentAppData.appId;+ });if (!eventTypePaymentAppCredential) {throw new HttpError({@@ -313,8 +285,7 @@ const createNewSeat = async (}: {},},- paymentAppCredentials:- eventTypePaymentAppCredential as IEventTypePaymentCredentialType,+ paymentAppCredentials: eventTypePaymentAppCredential as IEventTypePaymentCredentialType,booking: seatedBooking,bookerName: fullName,bookerEmail,diff --git a/packages/features/bookings/lib/handleSeats/lib/lastAttendeeDeleteBooking.ts b/packages/features/bookings/lib/handleSeats/lib/lastAttendeeDeleteBooking.tsindex 8da45bb2b3d..f0bcf7bfe18 100644--- a/packages/features/bookings/lib/handleSeats/lib/lastAttendeeDeleteBooking.ts+++ b/packages/features/bookings/lib/handleSeats/lib/lastAttendeeDeleteBooking.ts@@ -1,4 +1,3 @@-import { getCalendar } from "@calcom/app-store/_utils/getCalendar";import { getAllDelegationCredentialsForUserIncludeServiceAccountKey } from "@calcom/app-store/delegationCredential";import { getDelegationCredentialOrFindRegularCredential } from "@calcom/app-store/delegationCredential";diff --git a/packages/features/bookings/lib/handleSeats/reschedule/attendee/attendeeRescheduleSeatedBooking.ts b/packages/features/bookings/lib/handleSeats/reschedule/attendee/attendeeRescheduleSeatedBooking.tsindex b2563373fd3..2907fe84715 100644--- a/packages/features/bookings/lib/handleSeats/reschedule/attendee/attendeeRescheduleSeatedBooking.ts+++ b/packages/features/bookings/lib/handleSeats/reschedule/attendee/attendeeRescheduleSeatedBooking.ts@@ -1,4 +1,3 @@-import { cloneDeep } from "lodash";import { sendRescheduledSeatEmailAndSMS } from "@calcom/emails/email-manager";@@ -107,7 +106,11 @@ const attendeeRescheduleSeatedBooking = async (? addVideoCallDataToEvent(newTimeSlotBooking.references, copyEvent): copyEvent;- await sendRescheduledSeatEmailAndSMS(copyEventWithVideoCallData, seatAttendee as Person, eventType.metadata);+ await sendRescheduledSeatEmailAndSMS(+ copyEventWithVideoCallData,+ seatAttendee as Person,+ eventType.metadata+ );const filteredAttendees = originalRescheduledBooking?.attendees.filter((attendee) => {return attendee.email !== bookerEmail;});diff --git a/packages/features/bookings/lib/handleSeats/reschedule/owner/combineTwoSeatedBookings.ts b/packages/features/bookings/lib/handleSeats/reschedule/owner/combineTwoSeatedBookings.tsindex 85475ac823c..f393c0fb11b 100644--- a/packages/features/bookings/lib/handleSeats/reschedule/owner/combineTwoSeatedBookings.ts+++ b/packages/features/bookings/lib/handleSeats/reschedule/owner/combineTwoSeatedBookings.ts@@ -1,4 +1,3 @@-import { cloneDeep } from "lodash";import { uuid } from "short-uuid";diff --git a/packages/features/bookings/lib/handleSeats/reschedule/owner/moveSeatedBookingToNewTimeSlot.ts b/packages/features/bookings/lib/handleSeats/reschedule/owner/moveSeatedBookingToNewTimeSlot.tsindex d0994d60a52..69e8e6b8c3c 100644--- a/packages/features/bookings/lib/handleSeats/reschedule/owner/moveSeatedBookingToNewTimeSlot.ts+++ b/packages/features/bookings/lib/handleSeats/reschedule/owner/moveSeatedBookingToNewTimeSlot.ts@@ -1,4 +1,3 @@-import { cloneDeep } from "lodash";import { sendRescheduledEmailsAndSMS } from "@calcom/emails/email-manager";@@ -13,7 +12,17 @@ import { handleAppsStatus } from "../../../handleNewBooking/handleAppsStatus";import type { createLoggerWithEventDetails } from "../../../handleNewBooking/logger";import type { SeatedBooking, RescheduleSeatedBookingObject } from "../../types";-async function updateBooking({ bookingId, startTime, endTime, cancellationReason }: { bookingId: number, startTime: string, endTime: string, cancellationReason: string }): Promise<(Booking & { appsStatus?: AppsStatus[] })> {+async function updateBooking({+ bookingId,+ startTime,+ endTime,+ cancellationReason,+}: {+ bookingId: number;+ startTime: string;+ endTime: string;+ cancellationReason: string;+}): Promise<Booking & { appsStatus?: AppsStatus[] }> {const booking = await prisma.booking.update({where: {id: bookingId,@@ -51,7 +60,12 @@ const moveSeatedBookingToNewTimeSlot = async (} = rescheduleSeatedBookingObject;let { evt } = rescheduleSeatedBookingObject;- const newBooking = await updateBooking({ bookingId: seatedBooking.id, startTime: evt.startTime, endTime: evt.endTime, cancellationReason: rescheduleReason });+ const newBooking = await updateBooking({+ bookingId: seatedBooking.id,+ startTime: evt.startTime,+ endTime: evt.endTime,+ cancellationReason: rescheduleReason,+ });evt = { ...addVideoCallDataToEvent(newBooking.references, evt), bookerUrl: evt.bookerUrl };diff --git a/packages/features/bookings/lib/host-filtering/filterHostsBySameRoundRobinHost.ts b/packages/features/bookings/lib/host-filtering/filterHostsBySameRoundRobinHost.tsindex 398f5b9a4ac..5cbed94c2fa 100644--- a/packages/features/bookings/lib/host-filtering/filterHostsBySameRoundRobinHost.ts+++ b/packages/features/bookings/lib/host-filtering/filterHostsBySameRoundRobinHost.ts@@ -12,7 +12,7 @@ export class FilterHostsService {T extends {isFixed: false; // ensure no fixed hosts are passed.user: { id: number; email: string };- }+ },>({hosts,rescheduleUid,diff --git a/packages/features/bookings/lib/host-filtering/findQualifiedHostsWithDelegationCredentials.ts b/packages/features/bookings/lib/host-filtering/findQualifiedHostsWithDelegationCredentials.tsindex c53be6d3d7e..d4b935d31bb 100644--- a/packages/features/bookings/lib/host-filtering/findQualifiedHostsWithDelegationCredentials.ts+++ b/packages/features/bookings/lib/host-filtering/findQualifiedHostsWithDelegationCredentials.ts@@ -61,9 +61,9 @@ const isWithinRRHostSubset = <T extends { isFixed: boolean; user: { id: number }rrHostSubsetEnabled,schedulingType,}: { rrHostSubsetEnabled: boolean; schedulingType?: SchedulingType } = {- rrHostSubsetEnabled: false,- schedulingType: undefined,- }+ rrHostSubsetEnabled: false,+ schedulingType: undefined,+ }): host is T & { isFixed: false } => {if (rrHostSubsetIds.length === 0 || !rrHostSubsetEnabled || schedulingType !== SchedulingType.ROUND_ROBIN) {return true;@@ -72,7 +72,7 @@ const isWithinRRHostSubset = <T extends { isFixed: boolean; user: { id: number }};export class QualifiedHostsService {- constructor(public readonly dependencies: IQualifiedHostsService) { }+ constructor(public readonly dependencies: IQualifiedHostsService) {}async _findQualifiedHostsWithDelegationCredentials<T extends {@@ -81,7 +81,7 @@ export class QualifiedHostsService {uuid: string;credentials: CredentialPayload[];userLevelSelectedCalendars: SelectedCalendar[];- } & Record<string, unknown>+ } & Record<string, unknown>,>({eventType,rescheduleUid,diff --git a/packages/features/bookings/lib/onBookingEvents/BookingEventHandlerService.ts b/packages/features/bookings/lib/onBookingEvents/BookingEventHandlerService.tsindex 24d27fa8839..10d54a78436 100644--- a/packages/features/bookings/lib/onBookingEvents/BookingEventHandlerService.ts+++ b/packages/features/bookings/lib/onBookingEvents/BookingEventHandlerService.ts@@ -147,8 +147,16 @@ export class BookingEventHandlerService {}async onBookingAccepted(params: OnBookingAcceptedParams) {- const { bookingUid, actor, organizationId, auditData, source, operationId, context, isBookingAuditEnabled } =- params;+ const {+ bookingUid,+ actor,+ organizationId,+ auditData,+ source,+ operationId,+ context,+ isBookingAuditEnabled,+ } = params;await this.bookingAuditProducerService.queueAcceptedAudit({bookingUid,actor,@@ -162,8 +170,16 @@ export class BookingEventHandlerService {}async onBookingCancelled(params: OnBookingCancelledParams) {- const { bookingUid, actor, organizationId, auditData, source, operationId, context, isBookingAuditEnabled } =- params;+ const {+ bookingUid,+ actor,+ organizationId,+ auditData,+ source,+ operationId,+ context,+ isBookingAuditEnabled,+ } = params;await this.bookingAuditProducerService.queueCancelledAudit({bookingUid,actor,@@ -177,8 +193,16 @@ export class BookingEventHandlerService {}async onRescheduleRequested(params: OnRescheduleRequestedParams) {- const { bookingUid, actor, organizationId, auditData, source, operationId, context, isBookingAuditEnabled } =- params;+ const {+ bookingUid,+ actor,+ organizationId,+ auditData,+ source,+ operationId,+ context,+ isBookingAuditEnabled,+ } = params;await this.bookingAuditProducerService.queueRescheduleRequestedAudit({bookingUid,actor,@@ -192,8 +216,16 @@ export class BookingEventHandlerService {}async onAttendeeAdded(params: OnAttendeeAddedParams) {- const { bookingUid, actor, organizationId, auditData, source, operationId, context, isBookingAuditEnabled } =- params;+ const {+ bookingUid,+ actor,+ organizationId,+ auditData,+ source,+ operationId,+ context,+ isBookingAuditEnabled,+ } = params;await this.bookingAuditProducerService.queueAttendeeAddedAudit({bookingUid,actor,@@ -207,8 +239,16 @@ export class BookingEventHandlerService {}async onNoShowUpdated(params: OnNoShowUpdatedParams) {- const { bookingUid, actor, organizationId, auditData, source, operationId, context, isBookingAuditEnabled } =- params;+ const {+ bookingUid,+ actor,+ organizationId,+ auditData,+ source,+ operationId,+ context,+ isBookingAuditEnabled,+ } = params;await this.bookingAuditProducerService.queueNoShowUpdatedAudit({bookingUid,actor,@@ -222,8 +262,16 @@ export class BookingEventHandlerService {}async onBookingRejected(params: OnBookingRejectedParams) {- const { bookingUid, actor, organizationId, auditData, source, operationId, context, isBookingAuditEnabled } =- params;+ const {+ bookingUid,+ actor,+ organizationId,+ auditData,+ source,+ operationId,+ context,+ isBookingAuditEnabled,+ } = params;await this.bookingAuditProducerService.queueRejectedAudit({bookingUid,actor,@@ -237,8 +285,16 @@ export class BookingEventHandlerService {}async onAttendeeRemoved(params: OnAttendeeRemovedParams) {- const { bookingUid, actor, organizationId, auditData, source, operationId, context, isBookingAuditEnabled } =- params;+ const {+ bookingUid,+ actor,+ organizationId,+ auditData,+ source,+ operationId,+ context,+ isBookingAuditEnabled,+ } = params;await this.bookingAuditProducerService.queueAttendeeRemovedAudit({bookingUid,actor,@@ -252,8 +308,16 @@ export class BookingEventHandlerService {}async onReassignment(params: OnReassignmentParams) {- const { bookingUid, actor, organizationId, auditData, source, operationId, context, isBookingAuditEnabled } =- params;+ const {+ bookingUid,+ actor,+ organizationId,+ auditData,+ source,+ operationId,+ context,+ isBookingAuditEnabled,+ } = params;await this.bookingAuditProducerService.queueReassignmentAudit({bookingUid,actor,@@ -268,8 +332,16 @@ export class BookingEventHandlerService {async onLocationChanged(params: OnLocationChangedParams) {try {- const { bookingUid, actor, organizationId, auditData, source, operationId, context, isBookingAuditEnabled } =- params;+ const {+ bookingUid,+ actor,+ organizationId,+ auditData,+ source,+ operationId,+ context,+ isBookingAuditEnabled,+ } = params;await this.bookingAuditProducerService.queueLocationChangedAudit({bookingUid,actor,@@ -286,8 +358,16 @@ export class BookingEventHandlerService {}async onSeatBooked(params: OnSeatBookedParams) {- const { bookingUid, actor, organizationId, auditData, source, operationId, context, isBookingAuditEnabled } =- params;+ const {+ bookingUid,+ actor,+ organizationId,+ auditData,+ source,+ operationId,+ context,+ isBookingAuditEnabled,+ } = params;await this.bookingAuditProducerService.queueSeatBookedAudit({bookingUid,actor,@@ -301,8 +381,16 @@ export class BookingEventHandlerService {}async onSeatRescheduled(params: OnSeatRescheduledParams) {- const { bookingUid, actor, organizationId, auditData, source, operationId, context, isBookingAuditEnabled } =- params;+ const {+ bookingUid,+ actor,+ organizationId,+ auditData,+ source,+ operationId,+ context,+ isBookingAuditEnabled,+ } = params;await this.bookingAuditProducerService.queueSeatRescheduledAudit({bookingUid,actor,diff --git a/packages/features/bookings/lib/payment/handleNoShowFee.test.ts b/packages/features/bookings/lib/payment/handleNoShowFee.test.tsindex 6d0ff342f51..dfcaf3e54a1 100644--- a/packages/features/bookings/lib/payment/handleNoShowFee.test.ts+++ b/packages/features/bookings/lib/payment/handleNoShowFee.test.ts@@ -52,9 +52,11 @@ vi.mock("@calcom/features/membership/repositories/MembershipRepository", () => (}));vi.mock("@calcom/features/ee/teams/repositories/TeamRepository", () => ({- TeamRepository: vi.fn().mockImplementation(function() { return {- findParentOrganizationByTeamId: vi.fn(),- }; }),+ TeamRepository: vi.fn().mockImplementation(function () {+ return {+ findParentOrganizationByTeamId: vi.fn(),+ };+ }),}));vi.mock("@calcom/prisma", () => ({@@ -71,7 +73,9 @@ describe("handleNoShowFee", () => {};const paymentServiceModule = await PaymentServiceMap.stripepayment;- vi.mocked(paymentServiceModule.BuildPaymentService).mockImplementation(function() { return mockPaymentService; });+ vi.mocked(paymentServiceModule.BuildPaymentService).mockImplementation(function () {+ return mockPaymentService;+ });});const mockBooking = {@@ -220,7 +224,9 @@ describe("handleNoShowFee", () => {const mockTeamRepository = {findParentOrganizationByTeamId: vi.fn().mockResolvedValue({ id: 2 }),};- vi.mocked(TeamRepository).mockImplementation(function() { return mockTeamRepository; });+ vi.mocked(TeamRepository).mockImplementation(function () {+ return mockTeamRepository;+ });const result = await handleNoShowFee({booking: teamBooking,diff --git a/packages/features/bookings/lib/reschedule/determineReschedulePreventionRedirect.test.ts b/packages/features/bookings/lib/reschedule/determineReschedulePreventionRedirect.test.tsindex 7a7c804b196..c54b5343efe 100644--- a/packages/features/bookings/lib/reschedule/determineReschedulePreventionRedirect.test.ts+++ b/packages/features/bookings/lib/reschedule/determineReschedulePreventionRedirect.test.ts@@ -38,27 +38,27 @@ const createTestBooking = (overrides?: {const defaultEndTime = futureDate(5);const defaultStartTime = new Date(defaultEndTime.getTime() - 30 * 60 * 1000); // 30 minutes before endTimereturn {- uid: overrides?.uid || "test-booking-uid",- status: overrides?.status || BookingStatus.ACCEPTED,+ uid: overrides?.uid || "test-booking-uid",+ status: overrides?.status || BookingStatus.ACCEPTED,startTime: overrides?.startTime !== undefined ? overrides.startTime : defaultStartTime,endTime: overrides?.endTime !== undefined ? overrides.endTime : defaultEndTime,- responses: overrides?.responses || {- name: "John Doe",- email: "[email protected]",- },- userId: overrides?.userId !== undefined ? overrides.userId : 1,- eventType:- overrides?.eventType !== undefined- ? overrides.eventType- : // Default values from DB- {- disableRescheduling: false,- allowReschedulingPastBookings: false,- allowBookingFromCancelledBookingReschedule: false,+ responses: overrides?.responses || {+ name: "John Doe",+ email: "[email protected]",+ },+ userId: overrides?.userId !== undefined ? overrides.userId : 1,+ eventType:+ overrides?.eventType !== undefined+ ? overrides.eventType+ : // Default values from DB+ {+ disableRescheduling: false,+ allowReschedulingPastBookings: false,+ allowBookingFromCancelledBookingReschedule: false,minimumRescheduleNotice: null,- teamId: null,- },- dynamicEventSlugRef: overrides?.dynamicEventSlugRef !== undefined ? overrides.dynamicEventSlugRef : null,+ teamId: null,+ },+ dynamicEventSlugRef: overrides?.dynamicEventSlugRef !== undefined ? overrides.dynamicEventSlugRef : null,};};diff --git a/packages/features/bookings/lib/service/InstantBookingCreateService.ts b/packages/features/bookings/lib/service/InstantBookingCreateService.tsindex b609813d1a4..0b46539772c 100644--- a/packages/features/bookings/lib/service/InstantBookingCreateService.ts+++ b/packages/features/bookings/lib/service/InstantBookingCreateService.ts@@ -225,16 +225,19 @@ export async function handler(},];- const guests = (reqBody.guests || []).reduce((guestArray, guest) => {- guestArray.push({- email: guest,- name: "",- timeZone: attendeeTimezone,- locale: "en",- phoneNumber: null,- });- return guestArray;- }, [] as typeof invitee);+ const guests = (reqBody.guests || []).reduce(+ (guestArray, guest) => {+ guestArray.push({+ email: guest,+ name: "",+ timeZone: attendeeTimezone,+ locale: "en",+ phoneNumber: null,+ });+ return guestArray;+ },+ [] as typeof invitee+ );const attendeesList = [...invitee, ...guests];const calVideoMeeting = await createInstantMeetingWithCalVideo(dayjs.utc(reqBody.end).toISOString());diff --git a/packages/features/bookings/lib/service/RegularBookingService.ts b/packages/features/bookings/lib/service/RegularBookingService.tsindex f71f6a2b882..3892eabdd6d 100644--- a/packages/features/bookings/lib/service/RegularBookingService.ts+++ b/packages/features/bookings/lib/service/RegularBookingService.ts@@ -1354,13 +1354,13 @@ async function handler(const metadataParseResult = userMetadataSchema.safeParse(organizerUser.metadata);const organizerMetadata = metadataParseResult.success ? metadataParseResult.data : undefined;const defaultApp = organizerMetadata?.defaultConferencingApp;-+if (defaultApp?.appSlug) {const app = getAppFromSlug(defaultApp.appSlug);locationBodyString = app?.appData?.location?.type || locationBodyString;-+const mainHostCalendar = eventType.destinationCalendar || organizerUser.destinationCalendar;-+if (locationBodyString === MeetLocationType && mainHostCalendar?.integration !== "google_calendar") {locationBodyString = "integrations:daily";organizerOrFirstDynamicGroupMemberDefaultLocationUrl = undefined;@@ -1371,7 +1371,6 @@ async function handler(locationBodyString = organizationDefaultLocation || "integrations:daily";}}-const invitee: Invitee = [{diff --git a/packages/features/bookings/repositories/BookingRepository.integration-test.ts b/packages/features/bookings/repositories/BookingRepository.integration-test.tsindex 7774f8e33ab..b1ce9d4f736 100644--- a/packages/features/bookings/repositories/BookingRepository.integration-test.ts+++ b/packages/features/bookings/repositories/BookingRepository.integration-test.ts@@ -339,9 +339,7 @@ describe("BookingRepository (Integration Tests)", () => {});expect(bookings).toHaveLength(1);- expect(bookings[0].startTime.toISOString()).toBe(- "2025-06-26T00:00:00.000Z"- );+ expect(bookings[0].startTime.toISOString()).toBe("2025-06-26T00:00:00.000Z");});});-});\ No newline at end of file+});diff --git a/packages/features/bookings/repositories/IAttendeeRepository.ts b/packages/features/bookings/repositories/IAttendeeRepository.tsindex 223b6f4a7df..d3290e5e733 100644--- a/packages/features/bookings/repositories/IAttendeeRepository.ts+++ b/packages/features/bookings/repositories/IAttendeeRepository.ts@@ -1,10 +1,9 @@/*** Attendee lookup interface- *+ ** This interface provides methods for looking up attendee information.*/export interface IAttendeeRepository {- findById(id: number): Promise<{ name: string; email: string } | null>;- findByIds({ ids }: { ids: number[] }): Promise<{ id: number; name: string; email: string }[]>;+ findById(id: number): Promise<{ name: string; email: string } | null>;+ findByIds({ ids }: { ids: number[] }): Promise<{ id: number; name: string; email: string }[]>;}-diff --git a/packages/features/bookings/repositories/IBookingRepository.ts b/packages/features/bookings/repositories/IBookingRepository.tsindex 15303ef1598..b5eca6b6b9f 100644--- a/packages/features/bookings/repositories/IBookingRepository.ts+++ b/packages/features/bookings/repositories/IBookingRepository.ts@@ -12,11 +12,11 @@ export interface BookingWhereInput {export type BookingWhereUniqueInput =| {- id: number;- }+ id: number;+ }| {- uid: string;- };+ uid: string;+ };export interface BookingUpdateData {status?: BookingStatus;diff --git a/packages/features/bookings/services/BookingAccessService.test.ts b/packages/features/bookings/services/BookingAccessService.test.tsindex 2365de50cf7..c417177f5c4 100644--- a/packages/features/bookings/services/BookingAccessService.test.ts+++ b/packages/features/bookings/services/BookingAccessService.test.ts@@ -40,8 +40,12 @@ describe("BookingAccessService", () => {checkPermission: vi.fn(),};- vi.mocked(BookingRepository).mockImplementation(function() { return mockBookingRepo as any; });- vi.mocked(UserRepository).mockImplementation(function() { return mockUserRepo as any; });+ vi.mocked(BookingRepository).mockImplementation(function () {+ return mockBookingRepo as any;+ });+ vi.mocked(UserRepository).mockImplementation(function () {+ return mockUserRepo as any;+ });service = new BookingAccessService(mockPrismaClient);diff --git a/packages/features/bookings/services/BookingAccessService.ts b/packages/features/bookings/services/BookingAccessService.tsindex eac7821262d..be035b9f7cd 100644--- a/packages/features/bookings/services/BookingAccessService.ts+++ b/packages/features/bookings/services/BookingAccessService.ts@@ -64,8 +64,8 @@ export class BookingAccessService {const booking = bookingUid? await bookingRepo.findByUidIncludeEventType({ bookingUid }): bookingId- ? await bookingRepo.findByIdIncludeEventType({ bookingId })- : null;+ ? await bookingRepo.findByIdIncludeEventType({ bookingId })+ : null;if (!booking) return false;diff --git a/packages/features/calAIPhone/AIPhoneServiceRegistry.test.ts b/packages/features/calAIPhone/AIPhoneServiceRegistry.test.tsindex eb4e0b2c1bc..ea0d2fe732e 100644--- a/packages/features/calAIPhone/AIPhoneServiceRegistry.test.ts+++ b/packages/features/calAIPhone/AIPhoneServiceRegistry.test.ts@@ -16,7 +16,7 @@ import { AIPhoneServiceProviderType } from "./interfaces/AIPhoneService.interfacvi.stubEnv("RETELL_AI_KEY", "test-api-key");vi.mock("./providers/retellAI", () => ({- RetellAIPhoneServiceProviderFactory: vi.fn().mockImplementation(function() {+ RetellAIPhoneServiceProviderFactory: vi.fn().mockImplementation(function () {return {create: vi.fn().mockReturnValue({setupConfiguration: vi.fn(),diff --git a/packages/features/calAIPhone/interfaces/AIPhoneService.interface.ts b/packages/features/calAIPhone/interfaces/AIPhoneService.interface.tsindex 6751e5fc172..7d68bfd06e2 100644--- a/packages/features/calAIPhone/interfaces/AIPhoneService.interface.ts+++ b/packages/features/calAIPhone/interfaces/AIPhoneService.interface.ts@@ -49,7 +49,7 @@ export type AIPhoneServiceConfiguration<T extends AIPhoneServiceProviderType = AAIPhoneServiceProviderTypeMap[T]["Configuration"];export type AIPhoneServiceUpdateModelParams<- T extends AIPhoneServiceProviderType = AIPhoneServiceProviderType+ T extends AIPhoneServiceProviderType = AIPhoneServiceProviderType,> = AIPhoneServiceProviderTypeMap[T]["UpdateModelParams"];export type AIPhoneServiceModel<T extends AIPhoneServiceProviderType = AIPhoneServiceProviderType> =@@ -65,37 +65,37 @@ export type AIPhoneServicePhoneNumber<T extends AIPhoneServiceProviderType = AIPAIPhoneServiceProviderTypeMap[T]["PhoneNumber"];export type AIPhoneServiceUpdatePhoneNumberParams<- T extends AIPhoneServiceProviderType = AIPhoneServiceProviderType+ T extends AIPhoneServiceProviderType = AIPhoneServiceProviderType,> = AIPhoneServiceProviderTypeMap[T]["UpdatePhoneNumberParams"];export type AIPhoneServiceCreatePhoneNumberParams<- T extends AIPhoneServiceProviderType = AIPhoneServiceProviderType+ T extends AIPhoneServiceProviderType = AIPhoneServiceProviderType,> = AIPhoneServiceProviderTypeMap[T]["CreatePhoneNumberParams"];export type AIPhoneServiceImportPhoneNumberParams<- T extends AIPhoneServiceProviderType = AIPhoneServiceProviderType+ T extends AIPhoneServiceProviderType = AIPhoneServiceProviderType,> = AIPhoneServiceProviderTypeMap[T]["ImportPhoneNumberParams"];export type AIPhoneServiceUpdateAgentParams<- T extends AIPhoneServiceProviderType = AIPhoneServiceProviderType+ T extends AIPhoneServiceProviderType = AIPhoneServiceProviderType,> = AIPhoneServiceProviderTypeMap[T]["UpdateAgentParams"];export type AIPhoneServiceTools<T extends AIPhoneServiceProviderType = AIPhoneServiceProviderType> =AIPhoneServiceProviderTypeMap[T]["Tools"];export type AIPhoneServiceCreatePhoneCallParams<- T extends AIPhoneServiceProviderType = AIPhoneServiceProviderType+ T extends AIPhoneServiceProviderType = AIPhoneServiceProviderType,> = AIPhoneServiceProviderTypeMap[T]["CreatePhoneCallParams"];export type AIPhoneServiceAgentWithDetails<- T extends AIPhoneServiceProviderType = AIPhoneServiceProviderType+ T extends AIPhoneServiceProviderType = AIPhoneServiceProviderType,> = AIPhoneServiceProviderTypeMap[T]["AgentWithDetails"];export type AIPhoneServiceListCallsParams<T extends AIPhoneServiceProviderType = AIPhoneServiceProviderType> =AIPhoneServiceProviderTypeMap[T]["ListCallsParams"];export type AIPhoneServiceListCallsResponse<- T extends AIPhoneServiceProviderType = AIPhoneServiceProviderType+ T extends AIPhoneServiceProviderType = AIPhoneServiceProviderType,> = AIPhoneServiceProviderTypeMap[T]["ListCallsResponse"];export type AIPhoneServiceVoice<T extends AIPhoneServiceProviderType = AIPhoneServiceProviderType> =@@ -120,7 +120,7 @@ export type AIPhoneServiceCallData<T extends AIPhoneServiceProviderType = AIPhon// Extended import phone number params with additional fieldsexport type AIPhoneServiceImportPhoneNumberParamsExtended<- T extends AIPhoneServiceProviderType = AIPhoneServiceProviderType+ T extends AIPhoneServiceProviderType = AIPhoneServiceProviderType,> = AIPhoneServiceImportPhoneNumberParams<T> & {userId: number;teamId?: number;@@ -420,7 +420,7 @@ export interface AIPhoneServiceProviderConfig {* Factory interface for creating AI phone service providers*/export interface AIPhoneServiceProviderFactory<- T extends AIPhoneServiceProviderType = AIPhoneServiceProviderType+ T extends AIPhoneServiceProviderType = AIPhoneServiceProviderType,> {create(config: AIPhoneServiceProviderConfig): AIPhoneServiceProvider<T>;}diff --git a/packages/features/calAIPhone/providers/retellAI/RetellAIPhoneServiceProviderFactory.test.ts b/packages/features/calAIPhone/providers/retellAI/RetellAIPhoneServiceProviderFactory.test.tsindex e3911958947..f1c58f54f37 100644--- a/packages/features/calAIPhone/providers/retellAI/RetellAIPhoneServiceProviderFactory.test.ts+++ b/packages/features/calAIPhone/providers/retellAI/RetellAIPhoneServiceProviderFactory.test.ts@@ -66,37 +66,43 @@ vi.mock("./RetellAIPhoneServiceProvider", () => ({}));vi.mock("../adapters/PrismaAgentRepositoryAdapter", () => ({- PrismaAgentRepositoryAdapter: vi.fn().mockImplementation(function() { return {- canManageTeamResources: vi.fn(),- findByIdWithUserAccess: vi.fn(),- findByProviderAgentIdWithUserAccess: vi.fn(),- findManyWithUserAccess: vi.fn(),- findByIdWithUserAccessAndDetails: vi.fn(),- create: vi.fn(),- findByIdWithAdminAccess: vi.fn(),- findByIdWithCallAccess: vi.fn(),- delete: vi.fn(),- linkOutboundAgentToWorkflow: vi.fn(),- }; }),+ PrismaAgentRepositoryAdapter: vi.fn().mockImplementation(function () {+ return {+ canManageTeamResources: vi.fn(),+ findByIdWithUserAccess: vi.fn(),+ findByProviderAgentIdWithUserAccess: vi.fn(),+ findManyWithUserAccess: vi.fn(),+ findByIdWithUserAccessAndDetails: vi.fn(),+ create: vi.fn(),+ findByIdWithAdminAccess: vi.fn(),+ findByIdWithCallAccess: vi.fn(),+ delete: vi.fn(),+ linkOutboundAgentToWorkflow: vi.fn(),+ };+ }),}));vi.mock("../adapters/PrismaPhoneNumberRepositoryAdapter", () => ({- PrismaPhoneNumberRepositoryAdapter: vi.fn().mockImplementation(function() { return {- findByPhoneNumberAndUserId: vi.fn(),- findByPhoneNumberAndTeamId: vi.fn(),- findByIdAndUserId: vi.fn(),- findByIdWithTeamAccess: vi.fn(),- createPhoneNumber: vi.fn(),- deletePhoneNumber: vi.fn(),- updateSubscriptionStatus: vi.fn(),- updateAgents: vi.fn(),- }; }),+ PrismaPhoneNumberRepositoryAdapter: vi.fn().mockImplementation(function () {+ return {+ findByPhoneNumberAndUserId: vi.fn(),+ findByPhoneNumberAndTeamId: vi.fn(),+ findByIdAndUserId: vi.fn(),+ findByIdWithTeamAccess: vi.fn(),+ createPhoneNumber: vi.fn(),+ deletePhoneNumber: vi.fn(),+ updateSubscriptionStatus: vi.fn(),+ updateAgents: vi.fn(),+ };+ }),}));vi.mock("../adapters/PrismaTransactionAdapter", () => ({- PrismaTransactionAdapter: vi.fn().mockImplementation(function() { return {- executeInTransaction: vi.fn(),- }; }),+ PrismaTransactionAdapter: vi.fn().mockImplementation(function () {+ return {+ executeInTransaction: vi.fn(),+ };+ }),}));describe("RetellAIPhoneServiceProviderFactory", () => {diff --git a/packages/features/calAIPhone/providers/retellAI/RetellAIService.test.ts b/packages/features/calAIPhone/providers/retellAI/RetellAIService.test.tsindex 50fcc09fb80..52408f690dc 100644--- a/packages/features/calAIPhone/providers/retellAI/RetellAIService.test.ts+++ b/packages/features/calAIPhone/providers/retellAI/RetellAIService.test.ts@@ -34,7 +34,7 @@ vi.mock("@calcom/features/ee/payments/server/stripe", () => ({const mockGetAllCredits = vi.fn();const mockHasAvailableCredits = vi.fn();-const mockCreditService = vi.fn().mockImplementation(function() {+const mockCreditService = vi.fn().mockImplementation(function () {return {getAllCredits: mockGetAllCredits,hasAvailableCredits: mockHasAvailableCredits,@@ -851,7 +851,7 @@ describe("RetellAIService", () => {const { CreditService } = await import("@calcom/features/ee/billing/credit-service");const mockHasAvailableCredits = vi.fn().mockResolvedValue(true);- (CreditService as any).mockImplementation(function() {+ (CreditService as any).mockImplementation(function () {return {hasAvailableCredits: mockHasAvailableCredits,};@@ -935,7 +935,7 @@ describe("RetellAIService", () => {// Mock credit service to return false (no credits)const mockHasAvailableCredits = vi.fn().mockResolvedValue(false);- (CreditService as any).mockImplementation(function() {+ (CreditService as any).mockImplementation(function () {return {hasAvailableCredits: mockHasAvailableCredits,};@@ -958,7 +958,7 @@ describe("RetellAIService", () => {// Mock sufficient credits to get past credit checkconst mockHasAvailableCredits = vi.fn().mockResolvedValue(true);- (CreditService as any).mockImplementation(function() {+ (CreditService as any).mockImplementation(function () {return {hasAvailableCredits: mockHasAvailableCredits,};@@ -982,7 +982,7 @@ describe("RetellAIService", () => {// Mock sufficient creditsconst mockHasAvailableCredits = vi.fn().mockResolvedValue(true);- (CreditService as any).mockImplementation(function() {+ (CreditService as any).mockImplementation(function () {return {hasAvailableCredits: mockHasAvailableCredits,};@@ -1008,7 +1008,7 @@ describe("RetellAIService", () => {// Mock sufficient creditsconst mockHasAvailableCredits = vi.fn().mockResolvedValue(true);- (CreditService as any).mockImplementation(function() {+ (CreditService as any).mockImplementation(function () {return {hasAvailableCredits: mockHasAvailableCredits,};diff --git a/packages/features/calAIPhone/providers/retellAI/RetellSDKClient.test.ts b/packages/features/calAIPhone/providers/retellAI/RetellSDKClient.test.tsindex 48a925bcd45..2a224ca2f3f 100644--- a/packages/features/calAIPhone/providers/retellAI/RetellSDKClient.test.ts+++ b/packages/features/calAIPhone/providers/retellAI/RetellSDKClient.test.ts@@ -16,7 +16,7 @@ import type {let RetellSDKClient: typeof import("./RetellSDKClient").RetellSDKClient;vi.mock("retell-sdk", () => ({- Retell: vi.fn().mockImplementation(function() {+ Retell: vi.fn().mockImplementation(function () {return {llm: {create: vi.fn(),@@ -109,7 +109,9 @@ describe("RetellSDKClient", () => {},};- (Retell as any).mockImplementation(function() { return mockRetellInstance; });+ (Retell as any).mockImplementation(function () {+ return mockRetellInstance;+ });});describe("constructor", () => {diff --git a/packages/features/calAIPhone/providers/retellAI/errors.ts b/packages/features/calAIPhone/providers/retellAI/errors.tsindex 8e9ad61294e..691b3f6b403 100644--- a/packages/features/calAIPhone/providers/retellAI/errors.ts+++ b/packages/features/calAIPhone/providers/retellAI/errors.ts@@ -1,5 +1,9 @@export class RetellAIError extends Error {- constructor(message: string, public readonly operation: string, public readonly originalError?: unknown) {+ constructor(+ message: string,+ public readonly operation: string,+ public readonly originalError?: unknown+ ) {super(message);this.name = "RetellAIError";}diff --git a/packages/features/calAIPhone/providers/retellAI/services/AgentService.ts b/packages/features/calAIPhone/providers/retellAI/services/AgentService.tsindex 0156189a8c1..40024553936 100644--- a/packages/features/calAIPhone/providers/retellAI/services/AgentService.ts+++ b/packages/features/calAIPhone/providers/retellAI/services/AgentService.ts@@ -131,11 +131,11 @@ export class AgentService {const apiKey =RETELL_AI_TEST_MODE && process.env.RETELL_AI_TEST_CAL_API_KEY? process.env.RETELL_AI_TEST_CAL_API_KEY- : reusableKey ??+ : (reusableKey ??(await this.createApiKey({userId: data.userId,teamId: data.teamId || undefined,- }));+ })));const newEventTools: NonNullable<AIPhoneServiceTools<AIPhoneServiceProviderType.RETELL_AI>> = [];if (!hasCheck) {diff --git a/packages/features/calAIPhone/providers/retellAI/services/BillingService.ts b/packages/features/calAIPhone/providers/retellAI/services/BillingService.tsindex abb25f5783d..81cda4dfef3 100644--- a/packages/features/calAIPhone/providers/retellAI/services/BillingService.ts+++ b/packages/features/calAIPhone/providers/retellAI/services/BillingService.ts@@ -26,7 +26,7 @@ export class BillingService {phoneNumberRepository: PhoneNumberRepositoryInterface;retellRepository: RetellAIRepository;}- ) { }+ ) {}async generatePhoneNumberCheckoutSession({userId,@@ -83,8 +83,14 @@ export class BillingService {agentId: agentId || "",workflowId: workflowId || "",type: CHECKOUT_SESSION_TYPES.PHONE_NUMBER_SUBSCRIPTION,- ...(tracking?.googleAds?.gclid && { gclid: tracking.googleAds.gclid, campaignId: tracking.googleAds.campaignId }),- ...(tracking?.linkedInAds?.liFatId && { liFatId: tracking.linkedInAds.liFatId, linkedInCampaignId: tracking.linkedInAds?.campaignId }),+ ...(tracking?.googleAds?.gclid && {+ gclid: tracking.googleAds.gclid,+ campaignId: tracking.googleAds.campaignId,+ }),+ ...(tracking?.linkedInAds?.liFatId && {+ liFatId: tracking.linkedInAds.liFatId,+ linkedInCampaignId: tracking.linkedInAds?.campaignId,+ }),},subscription_data: {metadata: {@@ -119,14 +125,14 @@ export class BillingService {// Find phone number with proper team authorizationconst phoneNumber = teamId? await this.deps.phoneNumberRepository.findByIdWithTeamAccess({- id: phoneNumberId,- teamId,- userId,- })+ id: phoneNumberId,+ teamId,+ userId,+ }): await this.deps.phoneNumberRepository.findByIdAndUserId({- id: phoneNumberId,- userId,- });+ id: phoneNumberId,+ userId,+ });if (!phoneNumber) {throw new HttpError({diff --git a/packages/features/calAIPhone/providers/retellAI/services/__tests__/test-utils.ts b/packages/features/calAIPhone/providers/retellAI/services/__tests__/test-utils.tsindex cae376afda1..46e47b3405a 100644--- a/packages/features/calAIPhone/providers/retellAI/services/__tests__/test-utils.ts+++ b/packages/features/calAIPhone/providers/retellAI/services/__tests__/test-utils.ts@@ -192,14 +192,20 @@ export const setupRateLimitMocks = () => {// Test Error Classesexport class TestError extends Error {- constructor(message: string, public code?: string) {+ constructor(+ message: string,+ public code?: string+ ) {super(message);this.name = "TestError";}}export class TestRetellAPIError extends Error {- constructor(message: string, public statusCode: number = 500) {+ constructor(+ message: string,+ public statusCode: number = 500+ ) {super(message);this.name = "TestRetellAPIError";}diff --git a/packages/features/calAIPhone/repositories/PrismaAgentRepository.ts b/packages/features/calAIPhone/repositories/PrismaAgentRepository.tsindex d562e00faeb..6e11a21931f 100644--- a/packages/features/calAIPhone/repositories/PrismaAgentRepository.ts+++ b/packages/features/calAIPhone/repositories/PrismaAgentRepository.ts@@ -293,21 +293,24 @@ export class PrismaAgentRepository {: [];// Map phone numbers to agents- const phoneNumbersByAgent = phoneNumbers.reduce((acc, pn) => {- const agentId = pn.outboundAgentId;- if (agentId) {- if (!acc[agentId]) {- acc[agentId] = [];+ const phoneNumbersByAgent = phoneNumbers.reduce(+ (acc, pn) => {+ const agentId = pn.outboundAgentId;+ if (agentId) {+ if (!acc[agentId]) {+ acc[agentId] = [];+ }+ acc[agentId].push({+ id: pn.id,+ phoneNumber: pn.phoneNumber,+ subscriptionStatus: pn.subscriptionStatus,+ provider: pn.provider,+ });}- acc[agentId].push({- id: pn.id,- phoneNumber: pn.phoneNumber,- subscriptionStatus: pn.subscriptionStatus,- provider: pn.provider,- });- }- return acc;- }, {} as Record<string, _PhoneNumberRawResult[]>);+ return acc;+ },+ {} as Record<string, _PhoneNumberRawResult[]>+ );// Transform results to match expected formatreturn agents.map((agent) => ({diff --git a/packages/features/calAIPhone/repositories/PrismaPhoneNumberRepository.ts b/packages/features/calAIPhone/repositories/PrismaPhoneNumberRepository.tsindex c543f06e8a9..bb5b479ef5a 100644--- a/packages/features/calAIPhone/repositories/PrismaPhoneNumberRepository.ts+++ b/packages/features/calAIPhone/repositories/PrismaPhoneNumberRepository.ts@@ -104,26 +104,29 @@ export class PrismaPhoneNumberRepository {`: [];- const agentsByPhoneNumber = agents.reduce((acc, agent) => {- const phoneNumberId = agent.phoneNumberId;- if (!acc[phoneNumberId]) {- acc[phoneNumberId] = { inbound: null, outbound: null };- }+ const agentsByPhoneNumber = agents.reduce(+ (acc, agent) => {+ const phoneNumberId = agent.phoneNumberId;+ if (!acc[phoneNumberId]) {+ acc[phoneNumberId] = { inbound: null, outbound: null };+ }- const agentData = {- id: agent.id,- name: agent.name,- providerAgentId: agent.providerAgentId,- };+ const agentData = {+ id: agent.id,+ name: agent.name,+ providerAgentId: agent.providerAgentId,+ };- if (agent.agentType === "inbound") {- acc[phoneNumberId].inbound = agentData;- } else if (agent.agentType === "outbound") {- acc[phoneNumberId].outbound = agentData;- }+ if (agent.agentType === "inbound") {+ acc[phoneNumberId].inbound = agentData;+ } else if (agent.agentType === "outbound") {+ acc[phoneNumberId].outbound = agentData;+ }- return acc;- }, {} as Record<number, { inbound: AgentRawResult | null; outbound: AgentRawResult | null }>);+ return acc;+ },+ {} as Record<number, { inbound: AgentRawResult | null; outbound: AgentRawResult | null }>+ );return phoneNumbers.map((pn) => ({id: pn.id,@@ -392,26 +395,29 @@ export class PrismaPhoneNumberRepository {`: [];- const agentsByPhoneNumber = agents.reduce((acc, agent) => {- const phoneNumberId = agent.phoneNumberId;- if (!acc[phoneNumberId]) {- acc[phoneNumberId] = { inbound: null, outbound: null };- }+ const agentsByPhoneNumber = agents.reduce(+ (acc, agent) => {+ const phoneNumberId = agent.phoneNumberId;+ if (!acc[phoneNumberId]) {+ acc[phoneNumberId] = { inbound: null, outbound: null };+ }- const agentData = {- id: agent.id,- name: agent.name,- providerAgentId: agent.providerAgentId,- };+ const agentData = {+ id: agent.id,+ name: agent.name,+ providerAgentId: agent.providerAgentId,+ };- if (agent.agentType === "inbound") {- acc[phoneNumberId].inbound = agentData;- } else if (agent.agentType === "outbound") {- acc[phoneNumberId].outbound = agentData;- }+ if (agent.agentType === "inbound") {+ acc[phoneNumberId].inbound = agentData;+ } else if (agent.agentType === "outbound") {+ acc[phoneNumberId].outbound = agentData;+ }- return acc;- }, {} as Record<number, { inbound: AgentRawResult | null; outbound: AgentRawResult | null }>);+ return acc;+ },+ {} as Record<number, { inbound: AgentRawResult | null; outbound: AgentRawResult | null }>+ );return phoneNumbers.map((pn) => ({id: pn.id,diff --git a/packages/features/calAIPhone/retellAIService.ts b/packages/features/calAIPhone/retellAIService.tsindex 7436751b31d..ad7bf574c45 100644--- a/packages/features/calAIPhone/retellAIService.ts+++ b/packages/features/calAIPhone/retellAIService.ts@@ -123,7 +123,10 @@ class GetRetellLLMCommand implements Command<TGetRetellLLMSchema> {}class UpdateRetellLLMCommand implements Command<TGetRetellLLMSchema> {- constructor(private props: initProps, private llmId: string) {}+ constructor(+ private props: initProps,+ private llmId: string+ ) {}async execute(): Promise<TGetRetellLLMSchema> {try {@@ -167,7 +170,10 @@ export const validatePhoneNumber = (phoneNumber: string) => {};class CreateRetellPhoneCallCommand implements Command<TCreatePhoneSchema> {- constructor(private props: initProps, private numberToCall: string) {}+ constructor(+ private props: initProps,+ private numberToCall: string+ ) {}async execute(): Promise<TCreatePhoneSchema> {try {diff --git a/packages/features/calendar-subscription/adapters/GoogleCalendarSubscription.adapter.ts b/packages/features/calendar-subscription/adapters/GoogleCalendarSubscription.adapter.tsindex 01f1d002918..74c18e26d17 100644--- a/packages/features/calendar-subscription/adapters/GoogleCalendarSubscription.adapter.ts+++ b/packages/features/calendar-subscription/adapters/GoogleCalendarSubscription.adapter.ts@@ -174,14 +174,14 @@ export class GoogleCalendarSubscriptionAdapter implements ICalendarSubscriptionPconst start = event.start?.dateTime? new Date(event.start.dateTime): event.start?.date- ? new Date(event.start.date)- : new Date();+ ? new Date(event.start.date)+ : new Date();const end = event.end?.dateTime? new Date(event.end.dateTime): event.end?.date- ? new Date(event.end.date)- : new Date();+ ? new Date(event.end.date)+ : new Date();return {id: event.id as string,@@ -201,8 +201,8 @@ export class GoogleCalendarSubscriptionAdapter implements ICalendarSubscriptionPoriginalStartDate: event.originalStartTime?.dateTime? new Date(event.originalStartTime.dateTime): event.originalStartTime?.date- ? new Date(event.originalStartTime.date)- : null,+ ? new Date(event.originalStartTime.date)+ : null,createdAt: event.created ? new Date(event.created) : null,updatedAt: event.updated ? new Date(event.updated) : null,};diff --git a/packages/features/calendar-subscription/adapters/__tests__/GoogleCalendarSubscriptionAdapter.test.ts b/packages/features/calendar-subscription/adapters/__tests__/GoogleCalendarSubscriptionAdapter.test.tsindex 5bf687ce04c..0a9a2058798 100644--- a/packages/features/calendar-subscription/adapters/__tests__/GoogleCalendarSubscriptionAdapter.test.ts+++ b/packages/features/calendar-subscription/adapters/__tests__/GoogleCalendarSubscriptionAdapter.test.ts@@ -96,7 +96,7 @@ describe("GoogleCalendarSubscriptionAdapter", () => {};const { CalendarAuth } = await import("../__mocks__/CalendarAuth");- vi.mocked(CalendarAuth).mockImplementation(function() {+ vi.mocked(CalendarAuth).mockImplementation(function () {return {getClient: vi.fn().mockResolvedValue(mockClient),};diff --git a/packages/features/calendar-subscription/lib/telemetry/CalendarTelemetryWrapper.ts b/packages/features/calendar-subscription/lib/telemetry/CalendarTelemetryWrapper.tsindex b5dde69cf51..00051b06048 100644--- a/packages/features/calendar-subscription/lib/telemetry/CalendarTelemetryWrapper.ts+++ b/packages/features/calendar-subscription/lib/telemetry/CalendarTelemetryWrapper.ts@@ -151,7 +151,7 @@ export class CalendarTelemetryWrapper implements Calendar {cache: this.deps.cacheEnabled ? "on" : "off",calendarType: this.deps.calendarType,mode: String(this.deps.mode),- }+ },});metrics.distribution("calendar.getAvailabilityWithTimeZones.duration_ms", totalFetchDurationMs, {@@ -159,16 +159,15 @@ export class CalendarTelemetryWrapper implements Calendar {cache: this.deps.cacheEnabled ? "on" : "off",calendarType: this.deps.calendarType,mode: String(this.deps.mode),- }+ },});metrics.distribution("calendar.getAvailabilityWithTimeZones.events_count", results?.length ?? 0, {- attributes: {- cache: this.deps.cacheEnabled ? "on" : "off",- calendarType: this.deps.calendarType,- },- }- );+ attributes: {+ cache: this.deps.cacheEnabled ? "on" : "off",+ calendarType: this.deps.calendarType,+ },+ });log.debug("Calendar fetch with timezones completed", {calendarCount: selectedCalendars.length,diff --git a/packages/features/calendars/components/DatePicker.tsx b/packages/features/calendars/components/DatePicker.tsxindex efea5d85513..846ff07291c 100644--- a/packages/features/calendars/components/DatePicker.tsx+++ b/packages/features/calendars/components/DatePicker.tsx@@ -82,28 +82,23 @@ const Day = ({const buttonContent = (<buttontype="button"- style={- disabled- ? { ...disabledDateButtonEmbedStyles }- : { ...enabledDateButtonEmbedStyles }- }+ style={disabled ? { ...disabledDateButtonEmbedStyles } : { ...enabledDateButtonEmbedStyles }}className={classNames("disabled:text-bookinglighter absolute bottom-0 left-0 right-0 top-0 mx-auto w-full rounded-md border-2 border-transparent text-center text-sm font-medium transition disabled:cursor-default disabled:border-transparent disabled:font-light ",active? "bg-brand-default text-brand": !disabled- ? `${- !customClassName?.dayActive- ? "hover:border-brand-default text-emphasis bg-emphasis"- : `hover:border-brand-default ${customClassName.dayActive}`- }`- : `${customClassName ? "" : " text-mute"}`+ ? `${+ !customClassName?.dayActive+ ? "hover:border-brand-default text-emphasis bg-emphasis"+ : `hover:border-brand-default ${customClassName.dayActive}`+ }`+ : `${customClassName ? "" : " text-mute"}`)}data-testid="day"data-disabled={disabled}disabled={disabled}- {...props}- >+ {...props}>{away && <span data-testid="away-emoji">{emoji}</span>}{!away && date.date()}{date.isToday() && (@@ -111,8 +106,7 @@ const Day = ({className={classNames("bg-brand-default absolute left-1/2 top-1/2 flex h-[5px] w-[5px] -translate-x-1/2 translate-y-[8px] items-center justify-center rounded-full align-middle sm:translate-y-[12px]",active && "bg-brand-accent"- )}- >+ )}><span className="sr-only">{t("today")}</span></span>)}@@ -138,8 +132,7 @@ const Day = ({fontSize: "10px",lineHeight: "13px",padding: disabled ? "0 3px" : "3px 3px 3px 4px",- }}- >+ }}>{date.format("MMM")}</div>)}@@ -195,8 +188,7 @@ const Days = ({const isSecondWeekOver = today.isAfter(firstDayOfMonth.add(2, "week"));let days: (Dayjs | null)[] = [];- const getPadding = (day: number) =>- (browsingDate.set("date", day).day() - weekStart + 7) % 7;+ const getPadding = (day: number) => (browsingDate.set("date", day).day() - weekStart + 7) % 7;const totalDays = daysInMonth(browsingDate);const showNextMonthDays = isSecondWeekOver && !isCompact;@@ -229,18 +221,12 @@ const Days = ({}}- const [selectedDatesAndTimes] = useBookerStoreContext(- (state) => [state.selectedDatesAndTimes],- shallow- );+ const [selectedDatesAndTimes] = useBookerStoreContext((state) => [state.selectedDatesAndTimes], shallow);const isActive = (day: dayjs.Dayjs) => {// for selecting a range of datesif (Array.isArray(selected)) {- return (- Array.isArray(selected) &&- selected?.some((e) => yyyymmdd(e) === yyyymmdd(day))- );+ return Array.isArray(selected) && selected?.some((e) => yyyymmdd(e) === yyyymmdd(day));}if (selected && yyyymmdd(selected) === yyyymmdd(day)) {@@ -254,11 +240,9 @@ const Days = ({selectedDatesAndTimes[eventSlug as string] &&Object.keys(selectedDatesAndTimes[eventSlug as string]).length > 0) {- return Object.keys(selectedDatesAndTimes[eventSlug as string]).some(- (date) => {- return yyyymmdd(dayjs(date)) === yyyymmdd(day);- }- );+ return Object.keys(selectedDatesAndTimes[eventSlug as string]).some((date) => {+ return yyyymmdd(dayjs(date)) === yyyymmdd(day);+ });}return false;@@ -272,24 +256,18 @@ const Days = ({const oooInfo = daySlots.find((slot) => slot.away) || null;const isNextMonth = day.month() !== browsingDate.month();- const isFirstDayOfNextMonth =- isSecondWeekOver && !isCompact && isNextMonth && day.date() === 1;+ const isFirstDayOfNextMonth = isSecondWeekOver && !isCompact && isNextMonth && day.date() === 1;const included = includedDates?.includes(dateKey);const excluded = excludedDates.includes(dateKey);const hasAvailableSlots = daySlots.some((slot) => !slot.away);- const isOOOAllDay =- daySlots.length > 0 && daySlots.every((slot) => slot.away);+ const isOOOAllDay = daySlots.length > 0 && daySlots.every((slot) => slot.away);const away = isOOOAllDay;// OOO dates are selectable only if there's a redirect user OR the note is publicconst oooIsSelectable = oooInfo?.toUser || oooInfo?.showNotePublicly;- const disabled = away- ? !oooIsSelectable- : isNextMonth- ? !hasAvailableSlots- : !included || excluded;+ const disabled = away ? !oooIsSelectable : isNextMonth ? !hasAvailableSlots : !included || excluded;return {day,@@ -314,13 +292,10 @@ const Days = ({if (selected instanceof Array) {return;}- const firstAvailableDateOfTheMonth = daysToRenderForTheMonth.find(- (day) => !day.disabled- )?.day;+ const firstAvailableDateOfTheMonth = daysToRenderForTheMonth.find((day) => !day.disabled)?.day;const isSelectedDateAvailable = selected? daysToRenderForTheMonth.some(({ day, disabled }) => {- if (day && yyyymmdd(day) === yyyymmdd(selected) && !disabled)- return true;+ if (day && yyyymmdd(day) === yyyymmdd(selected) && !disabled) return true;}): false;if (!isSelectedDateAvailable && firstAvailableDateOfTheMonth) {@@ -340,48 +315,38 @@ const Days = ({return (<>- {daysToRenderForTheMonth.map(- ({ day, disabled, away, emoji, isFirstDayOfNextMonth }, idx) => (- <div- key={day === null ? `e-${idx}` : `day-${day.format()}`}- className="relative w-full pt-[100%]"- >- {day === null ? (- <div key={`e-${idx}`} />- ) : props.isLoading ? (- <button- className="bg-cal-muted text-muted absolute bottom-0 left-0 right-0 top-0 mx-auto flex w-full items-center justify-center rounded-sm border-transparent text-center font-medium opacity-90 transition"- key={`e-${idx}`}- disabled- >- <SkeletonText className="h-8 w-9" />- </button>- ) : (- <DayComponent- customClassName={{- dayContainer: customClassName?.datePickerDate,- dayActive: customClassName?.datePickerDateActive,- }}- date={day}- onClick={() => {- props.onChange(day);- props?.scrollToTimeSlots?.();- }}- disabled={disabled}- active={isActive(day)}- away={away}- emoji={emoji}- showMonthTooltip={- showNextMonthDays &&- !disabled &&- day.month() !== browsingDate.month()- }- isFirstDayOfNextMonth={isFirstDayOfNextMonth}- />- )}- </div>- )- )}+ {daysToRenderForTheMonth.map(({ day, disabled, away, emoji, isFirstDayOfNextMonth }, idx) => (+ <div key={day === null ? `e-${idx}` : `day-${day.format()}`} className="relative w-full pt-[100%]">+ {day === null ? (+ <div key={`e-${idx}`} />+ ) : props.isLoading ? (+ <button+ className="bg-cal-muted text-muted absolute bottom-0 left-0 right-0 top-0 mx-auto flex w-full items-center justify-center rounded-sm border-transparent text-center font-medium opacity-90 transition"+ key={`e-${idx}`}+ disabled>+ <SkeletonText className="h-8 w-9" />+ </button>+ ) : (+ <DayComponent+ customClassName={{+ dayContainer: customClassName?.datePickerDate,+ dayActive: customClassName?.datePickerDateActive,+ }}+ date={day}+ onClick={() => {+ props.onChange(day);+ props?.scrollToTimeSlots?.();+ }}+ disabled={disabled}+ active={isActive(day)}+ away={away}+ emoji={emoji}+ showMonthTooltip={showNextMonthDays && !disabled && day.month() !== browsingDate.month()}+ isFirstDayOfNextMonth={isFirstDayOfNextMonth}+ />+ )}+ </div>+ ))}{!props.isLoading &&!isBookingInPast &&includedDates &&@@ -429,18 +394,13 @@ const DatePicker = ({scrollToTimeSlots?: () => void;}) => {const minDate = passThroughProps.minDate;- const rawBrowsingDate =- passThroughProps.browsingDate || dayjs().startOf("month");+ const rawBrowsingDate = passThroughProps.browsingDate || dayjs().startOf("month");const browsingDate =- minDate && rawBrowsingDate.valueOf() < minDate.valueOf()- ? dayjs(minDate)- : rawBrowsingDate;+ minDate && rawBrowsingDate.valueOf() < minDate.valueOf() ? dayjs(minDate) : rawBrowsingDate;const { i18n, t } = useLocale();const bookingData = useBookerStoreContext((state) => state.bookingData);- const isBookingInPast = bookingData- ? new Date(bookingData.endTime) < new Date()- : false;+ const isBookingInPast = bookingData ? new Date(bookingData.endTime) < new Date() : false;const changeMonth = (newMonth: number) => {if (onMonthChange) {onMonthChange(browsingDate.add(newMonth, "month"));@@ -457,24 +417,12 @@ const DatePicker = ({<div className="mb-1 flex items-center justify-between text-xl"><span className="text-default w-1/2 text-base">{browsingDate ? (- <time- dateTime={browsingDate.format("YYYY-MM")}- data-testid="selected-month-label"- >+ <time dateTime={browsingDate.format("YYYY-MM")} data-testid="selected-month-label"><strong- className={classNames(- `text-emphasis font-semibold`,- customClassNames?.datePickerTitle- )}- >+ className={classNames(`text-emphasis font-semibold`, customClassNames?.datePickerTitle)}>{month}</strong>{" "}- <span- className={classNames(- `text-subtle font-medium`,- customClassNames?.datePickerTitle- )}- >+ <span className={classNames(`text-subtle font-medium`, customClassNames?.datePickerTitle)}>{browsingDate.format("YYYY")}</span></time>@@ -521,8 +469,7 @@ const DatePicker = ({className={classNames(`text-emphasis my-4 text-xs font-medium uppercase tracking-widest`,customClassNames?.datePickerDays- )}- >+ )}>{weekDay}</div>))}diff --git a/packages/features/calendars/components/DestinationCalendarSelector.tsx b/packages/features/calendars/components/DestinationCalendarSelector.tsxindex 59da48591c7..20a08a5d1b1 100644--- a/packages/features/calendars/components/DestinationCalendarSelector.tsx+++ b/packages/features/calendars/components/DestinationCalendarSelector.tsx@@ -10,7 +10,6 @@ import { useEffect, useState } from "react";import type { OptionProps, SingleValueProps } from "react-select";import { components } from "react-select";-type CalendarWithPrimary = Omit<IntegrationCalendar, "primary"> & {primary?: boolean | null;isSelected?: boolean;diff --git a/packages/features/calendars/lib/CalendarManager.ts b/packages/features/calendars/lib/CalendarManager.tsindex f1eb527d83e..355f119cdeb 100644--- a/packages/features/calendars/lib/CalendarManager.ts+++ b/packages/features/calendars/lib/CalendarManager.ts@@ -52,7 +52,8 @@ export const processEvent = (calEvent: CalendarEvent): CalendarServiceEvent => {.some((domain) => calEvent.organizer.email.toLowerCase().endsWith(domain.toLowerCase()));// Zoho Calendar requires at least one attendee, so don't empty attendees array for Zoho Calendar- const hasZohoCalendar = calEvent.destinationCalendar?.some((cal) => cal.integration === "zoho_calendar") ?? false;+ const hasZohoCalendar =+ calEvent.destinationCalendar?.some((cal) => cal.integration === "zoho_calendar") ?? false;if (calEvent.hideOrganizerEmail && !isOrganizerExempt && !isMeetLocationType && !hasZohoCalendar) {calendarEvent.attendees = [];diff --git a/packages/features/calendars/lib/tasker/CalendarsSyncTasker.ts b/packages/features/calendars/lib/tasker/CalendarsSyncTasker.tsindex 531459c40fd..70d6a3d051f 100644--- a/packages/features/calendars/lib/tasker/CalendarsSyncTasker.ts+++ b/packages/features/calendars/lib/tasker/CalendarsSyncTasker.ts@@ -9,9 +9,7 @@ export interface ICalendarsSyncTaskerDependencies {}export class CalendarsSyncTasker implements ICalendarsTasker {- constructor(- public readonly dependencies: ITaskerDependencies & ICalendarsSyncTaskerDependencies- ) {}+ constructor(public readonly dependencies: ITaskerDependencies & ICalendarsSyncTaskerDependencies) {}async ensureDefaultCalendars(payload: Parameters<ICalendarsTasker["ensureDefaultCalendars"]>[0]diff --git a/packages/features/calendars/weeklyview/utils/overlap.ts b/packages/features/calendars/weeklyview/utils/overlap.tsindex db092ff249d..a3e75a954ab 100644--- a/packages/features/calendars/weeklyview/utils/overlap.ts+++ b/packages/features/calendars/weeklyview/utils/overlap.ts@@ -29,7 +29,7 @@ const DEFAULT_CONFIG: Required<OverlapLayoutConfig> = {* Calculates variable widths for each event in a cascade based on position* Leftmost (longest) events get more width, rightmost (shortest) get less width* Uses anchor points for 2-4 events and smooth easing curve for 5+ events- *+ ** @param groupSize - Number of overlapping events in the group* @param minWidthPercent - Minimum width to maintain readability (default 25%)* @param curveExponent - Easing curve exponent for width distribution (default 1.3)@@ -43,11 +43,11 @@ function calculateVariableWidths(if (groupSize <= 1) {return [100]; // Single event gets full width (100%)}-+// Define anchor points for first and last widths based on group sizelet wFirst: number;let wLast: number;-+if (groupSize === 2) {wFirst = 80;wLast = 50;@@ -61,7 +61,7 @@ function calculateVariableWidths(wFirst = Math.max(30, 40 - 3 * (groupSize - 4));wLast = minWidthPercent;}-+const widths: number[] = [];for (let i = 0; i < groupSize; i++) {const t = groupSize > 1 ? i / (groupSize - 1) : 0;@@ -69,7 +69,7 @@ function calculateVariableWidths(const width = wLast + (wFirst - wLast) * easedT;widths.push(Math.max(minWidthPercent, width));}-+return widths;}@@ -95,11 +95,11 @@ export function sortEvents(events: CalendarEvent[]): CalendarEvent[] {const startA = dayjs(a.start);const startB = dayjs(b.start);const startDiff = startA.diff(startB);-+if (startDiff !== 0) {return startDiff;}-+const endA = dayjs(a.end);const endB = dayjs(b.end);return endB.diff(endA);@@ -161,10 +161,10 @@ export function calculateEventLayouts(groups.forEach((group, groupIndex) => {const groupSize = group.length;-+const widths = calculateVariableWidths(groupSize, minWidthPercent, curveExponent);const Rmax = 100 - safetyMarginPercent;-+if (groupSize === 1) {const width = floor3(Math.min(widths[0], Rmax));layouts.push({@@ -177,13 +177,13 @@ export function calculateEventLayouts(});} else {const Rmin = widths[0];-+group.forEach((event, indexInGroup) => {const t = indexInGroup / (groupSize - 1);const ri = Rmin + (Rmax - Rmin) * t;const leftRaw = ri - widths[indexInGroup];const left = round3(leftRaw);-+const maxWidthCap = Rmax - left;const widthCap = Math.min(widths[indexInGroup], maxWidthCap);const width = floor3(Math.max(0, widthCap));diff --git a/packages/features/credentials/deleteCredential.test.ts b/packages/features/credentials/deleteCredential.test.tsindex 8c0b10e71a4..a38295b84a9 100644--- a/packages/features/credentials/deleteCredential.test.ts+++ b/packages/features/credentials/deleteCredential.test.ts@@ -1,7 +1,4 @@-import {- addEventTypesToDb,- mockNoTranslations,-} from "@calcom/testing/lib/bookingScenario/bookingScenario";+import { addEventTypesToDb, mockNoTranslations } from "@calcom/testing/lib/bookingScenario/bookingScenario";import { describe, test, expect, beforeEach } from "vitest";diff --git a/packages/features/credentials/handleDeleteCredential.ts b/packages/features/credentials/handleDeleteCredential.tsindex 31221135048..ee9b7f71cfc 100644--- a/packages/features/credentials/handleDeleteCredential.ts+++ b/packages/features/credentials/handleDeleteCredential.ts@@ -363,8 +363,8 @@ const handleDeleteCredential = async ({destinationCalendar: booking.destinationCalendar? [booking.destinationCalendar]: booking.user?.destinationCalendar- ? [booking.user?.destinationCalendar]- : [],+ ? [booking.user?.destinationCalendar]+ : [],cancellationReason: "Payment method removed by organizer",seatsPerTimeSlot: booking.eventType?.seatsPerTimeSlot,seatsShowAttendees: booking.eventType?.seatsShowAttendees,@@ -493,12 +493,15 @@ const removeAppFromEventTypeMetadata = (}) => {const appMetadata = eventTypeMetadata?.apps- ? Object.entries(eventTypeMetadata.apps).reduce((filteredApps, [appName, appData]) => {- if (appName !== appSlugToDelete) {- filteredApps[appName as keyof typeof eventTypeMetadata.apps] = appData;- }- return filteredApps;- }, {} as z.infer<typeof EventTypeAppMetadataSchema>)+ ? Object.entries(eventTypeMetadata.apps).reduce(+ (filteredApps, [appName, appData]) => {+ if (appName !== appSlugToDelete) {+ filteredApps[appName as keyof typeof eventTypeMetadata.apps] = appData;+ }+ return filteredApps;+ },+ {} as z.infer<typeof EventTypeAppMetadataSchema>+ ): {};return appMetadata;diff --git a/packages/features/credentials/repositories/CredentialRepository.ts b/packages/features/credentials/repositories/CredentialRepository.tsindex 04100a5fc70..95b98c7ffaf 100644--- a/packages/features/credentials/repositories/CredentialRepository.ts+++ b/packages/features/credentials/repositories/CredentialRepository.ts@@ -59,13 +59,7 @@ export class CredentialRepository {});return buildNonDelegationCredential(credential);}- static async findByAppIdAndUserId({- appId,- userId,- }: {- appId: string;- userId: number;- }) {+ static async findByAppIdAndUserId({ appId, userId }: { appId: string; userId: number }) {const credential = await prisma.credential.findFirst({where: {appId,@@ -97,13 +91,7 @@ export class CredentialRepository {return buildNonDelegationCredential(credential);}- static async findFirstByAppIdAndUserId({- appId,- userId,- }: {- appId: string;- userId: number;- }) {+ static async findFirstByAppIdAndUserId({ appId, userId }: { appId: string; userId: number }) {return await prisma.credential.findFirst({where: {appId,@@ -112,13 +100,7 @@ export class CredentialRepository {});}- static async findFirstByUserIdAndType({- userId,- type,- }: {- userId: number;- type: string;- }) {+ static async findFirstByUserIdAndType({ userId, type }: { userId: number; type: string }) {const credential = await prisma.credential.findFirst({where: { userId, type },});@@ -129,13 +111,7 @@ export class CredentialRepository {await prisma.credential.delete({ where: { id } });}- static async updateCredentialById({- id,- data,- }: {- id: number;- data: CredentialUpdateInput;- }) {+ static async updateCredentialById({ id, data }: { id: number; data: CredentialUpdateInput }) {await prisma.credential.update({where: { id },data,@@ -198,13 +174,7 @@ export class CredentialRepository {});}- static async findAllDelegationByTypeIncludeUserAndTake({- type,- take,- }: {- type: string;- take: number;- }) {+ static async findAllDelegationByTypeIncludeUserAndTake({ type, take }: { type: string; take: number }) {const delegationUserCredentials = await prisma.credential.findMany({where: {delegationCredentialId: { not: null },@@ -220,16 +190,14 @@ export class CredentialRepository {},take,});- return delegationUserCredentials.map(- ({ delegationCredentialId, ...rest }) => {- return {- ...rest,- // We queried only those where delegationCredentialId is not null-- delegationCredentialId: delegationCredentialId!,- };- }- );+ return delegationUserCredentials.map(({ delegationCredentialId, ...rest }) => {+ return {+ ...rest,+ // We queried only those where delegationCredentialId is not null++ delegationCredentialId: delegationCredentialId!,+ };+ });}static async findUniqueByUserIdAndDelegationCredentialId({@@ -249,13 +217,10 @@ export class CredentialRepository {if (delegationUserCredentials.length > 1) {// Instead of crashing use the first one and log for observability// TODO: Plan to add a unique constraint on userId and delegationCredentialId- log.error(- `DelegationCredential: Multiple delegation user credentials found - this should not happen`,- {- userId,- delegationCredentialId,- }- );+ log.error(`DelegationCredential: Multiple delegation user credentials found - this should not happen`, {+ userId,+ delegationCredentialId,+ });}return delegationUserCredentials[0];@@ -301,13 +266,7 @@ export class CredentialRepository {});}- static async updateWhereId({- id,- data,- }: {- id: number;- data: { key: Prisma.InputJsonValue };- }) {+ static async updateWhereId({ id, data }: { id: number; data: { key: Prisma.InputJsonValue } }) {return prisma.credential.update({ where: { id }, data });}@@ -446,12 +405,15 @@ export class CredentialRepository {}const key = credential.key as Record<string, unknown>;- const filteredKey = keyFields.reduce((acc, field) => {- if (field in key) {- acc[field] = key[field];- }- return acc;- }, {} as Record<string, unknown>);+ const filteredKey = keyFields.reduce(+ (acc, field) => {+ if (field in key) {+ acc[field] = key[field];+ }+ return acc;+ },+ {} as Record<string, unknown>+ );return { ...credential, key: filteredKey };}diff --git a/packages/features/credentials/services/CredentialAccessService.test.ts b/packages/features/credentials/services/CredentialAccessService.test.tsindex 14875ee7045..a8430a5a82b 100644--- a/packages/features/credentials/services/CredentialAccessService.test.ts+++ b/packages/features/credentials/services/CredentialAccessService.test.ts@@ -27,9 +27,11 @@ vi.mock("@calcom/features/credentials/repositories/CredentialRepository", () =>vi.mock("@calcom/features/users/repositories/UserRepository", () => {return {- UserRepository: vi.fn().mockImplementation(function() { return {- getUserOrganizationAndTeams: vi.fn(),- }; }),+ UserRepository: vi.fn().mockImplementation(function () {+ return {+ getUserOrganizationAndTeams: vi.fn(),+ };+ }),};});@@ -123,7 +125,9 @@ describe("CredentialAccessService", () => {}),};- vi.mocked(UserRepository).mockImplementation(function() { return mockUserRepo as any; });+ vi.mocked(UserRepository).mockImplementation(function () {+ return mockUserRepo as any;+ });const service = new CredentialAccessService();await expect(@@ -168,7 +172,9 @@ describe("CredentialAccessService", () => {}),};- vi.mocked(UserRepository).mockImplementation(function() { return mockUserRepo as any; });+ vi.mocked(UserRepository).mockImplementation(function () {+ return mockUserRepo as any;+ });const service = new CredentialAccessService();await expect(@@ -207,7 +213,9 @@ describe("CredentialAccessService", () => {}),};- vi.mocked(UserRepository).mockImplementation(function() { return mockUserRepo as any; });+ vi.mocked(UserRepository).mockImplementation(function () {+ return mockUserRepo as any;+ });const service = new CredentialAccessService();await expect(@@ -273,7 +281,9 @@ describe("CredentialAccessService", () => {}),};- vi.mocked(UserRepository).mockImplementation(function() { return mockUserRepo as any; });+ vi.mocked(UserRepository).mockImplementation(function () {+ return mockUserRepo as any;+ });const service = new CredentialAccessService();const error = await servicediff --git a/packages/features/data-table/hooks/useDebouncedWidth.ts b/packages/features/data-table/hooks/useDebouncedWidth.tsindex 60db166b9e1..378189308e5 100644--- a/packages/features/data-table/hooks/useDebouncedWidth.ts+++ b/packages/features/data-table/hooks/useDebouncedWidth.ts@@ -1,6 +1,5 @@"use client";-import debounce from "lodash/debounce";import { useState, useEffect } from "react";diff --git a/packages/features/data-table/hooks/useFilterValue.ts b/packages/features/data-table/hooks/useFilterValue.tsindex 1db4ddf8cc9..468fc74af90 100644--- a/packages/features/data-table/hooks/useFilterValue.ts+++ b/packages/features/data-table/hooks/useFilterValue.ts@@ -7,7 +7,7 @@ import { useDataTable } from "./useDataTable";export function useFilterValue<T extends FilterType,- TSchema extends FilterValueSchema<T> | typeof ZFilterValue+ TSchema extends FilterValueSchema<T> | typeof ZFilterValue,>(columnId: string, schema: TSchema) {const { activeFilters } = useDataTable();return useMemo(() => {diff --git a/packages/features/data-table/lib/types.ts b/packages/features/data-table/lib/types.tsindex 695df962387..3892c3ab56d 100644--- a/packages/features/data-table/lib/types.ts+++ b/packages/features/data-table/lib/types.ts@@ -140,27 +140,26 @@ export const ZColumnFilter = z.object({export type FilterValueSchema<T extends FilterType> = T extends ColumnFilterTypeValues["SINGLE_SELECT"]? typeof ZSingleSelectFilterValue: T extends ColumnFilterTypeValues["MULTI_SELECT"]- ? typeof ZMultiSelectFilterValue- : T extends ColumnFilterTypeValues["TEXT"]- ? typeof ZTextFilterValue- : T extends ColumnFilterTypeValues["NUMBER"]- ? typeof ZNumberFilterValue- : T extends ColumnFilterTypeValues["DATE_RANGE"]- ? typeof ZDateRangeFilterValue- : never;--export type FilterValue<T extends FilterType = FilterType> =- T extends ColumnFilterTypeValues["SINGLE_SELECT"]- ? SingleSelectFilterValue- : T extends ColumnFilterTypeValues["MULTI_SELECT"]+ ? typeof ZMultiSelectFilterValue+ : T extends ColumnFilterTypeValues["TEXT"]+ ? typeof ZTextFilterValue+ : T extends ColumnFilterTypeValues["NUMBER"]+ ? typeof ZNumberFilterValue+ : T extends ColumnFilterTypeValues["DATE_RANGE"]+ ? typeof ZDateRangeFilterValue+ : never;++export type FilterValue<T extends FilterType = FilterType> = T extends ColumnFilterTypeValues["SINGLE_SELECT"]+ ? SingleSelectFilterValue+ : T extends ColumnFilterTypeValues["MULTI_SELECT"]? MultiSelectFilterValue: T extends ColumnFilterTypeValues["TEXT"]- ? TextFilterValue- : T extends ColumnFilterTypeValues["NUMBER"]- ? NumberFilterValue- : T extends ColumnFilterTypeValues["DATE_RANGE"]- ? DateRangeFilterValue- : never;+ ? TextFilterValue+ : T extends ColumnFilterTypeValues["NUMBER"]+ ? NumberFilterValue+ : T extends ColumnFilterTypeValues["DATE_RANGE"]+ ? DateRangeFilterValue+ : never;export type TypedColumnFilter<T extends FilterType> = {id: string;diff --git a/packages/features/data-table/repositories/filterSegment.ts b/packages/features/data-table/repositories/filterSegment.tsindex 9351c05b0e5..821bd516c2b 100644--- a/packages/features/data-table/repositories/filterSegment.ts+++ b/packages/features/data-table/repositories/filterSegment.ts@@ -131,8 +131,8 @@ export class FilterSegmentRepository implements IFilterSegmentRepository {const preferredSegmentId = preference?.segmentId? { id: preference.segmentId, type: "user" as const }: preference?.systemSegmentId- ? { id: preference.systemSegmentId, type: "system" as const }- : null;+ ? { id: preference.systemSegmentId, type: "system" as const }+ : null;return {segments: parsedSegments,diff --git a/packages/features/di/containers/BookingAccessService.ts b/packages/features/di/containers/BookingAccessService.tsindex db13566a727..5bd19d4669b 100644--- a/packages/features/di/containers/BookingAccessService.ts+++ b/packages/features/di/containers/BookingAccessService.ts@@ -9,5 +9,3 @@ export function getBookingAccessService() {bookingAccessServiceModuleLoader.loadModule(container);return container.get<BookingAccessService>(bookingAccessServiceModuleLoader.token);}--diff --git a/packages/features/di/containers/BookingAuditViewerService.container.ts b/packages/features/di/containers/BookingAuditViewerService.container.tsindex a5dae8c3007..0df435546b0 100644--- a/packages/features/di/containers/BookingAuditViewerService.container.ts+++ b/packages/features/di/containers/BookingAuditViewerService.container.ts@@ -13,6 +13,5 @@ bookingAuditRepositoryModuleLoader.loadModule(container);bookingAuditViewerServiceModuleLoader.loadModule(container);export function getBookingAuditViewerService() {- return container.get<BookingAuditViewerService>(BOOKING_AUDIT_DI_TOKENS.BOOKING_AUDIT_VIEWER_SERVICE);+ return container.get<BookingAuditViewerService>(BOOKING_AUDIT_DI_TOKENS.BOOKING_AUDIT_VIEWER_SERVICE);}-diff --git a/packages/features/di/containers/FeaturesRepository.ts b/packages/features/di/containers/FeaturesRepository.tsindex 5070f8faade..65a016d239f 100644--- a/packages/features/di/containers/FeaturesRepository.ts+++ b/packages/features/di/containers/FeaturesRepository.ts@@ -1,5 +1,8 @@import { createContainer } from "../di";-import { type FeaturesRepository, moduleLoader as featuresRepositoryModuleLoader } from "../modules/FeaturesRepository";+import {+ type FeaturesRepository,+ moduleLoader as featuresRepositoryModuleLoader,+} from "../modules/FeaturesRepository";const featuresRepositoryContainer = createContainer();diff --git a/packages/features/di/containers/ManagedEventReassignment.ts b/packages/features/di/containers/ManagedEventReassignment.tsindex 5611b3863f8..e6f61b3199e 100644--- a/packages/features/di/containers/ManagedEventReassignment.ts+++ b/packages/features/di/containers/ManagedEventReassignment.ts@@ -7,8 +7,5 @@ const container = createContainer();export function getManagedEventReassignmentService() {managedEventReassignmentServiceModuleLoader.loadModule(container);- return container.get<ManagedEventReassignmentService>(- managedEventReassignmentServiceModuleLoader.token- );+ return container.get<ManagedEventReassignmentService>(managedEventReassignmentServiceModuleLoader.token);}-diff --git a/packages/features/di/modules/AssignmentReason.ts b/packages/features/di/modules/AssignmentReason.tsindex 7fe3e1f9669..c5c705e3e8e 100644--- a/packages/features/di/modules/AssignmentReason.ts+++ b/packages/features/di/modules/AssignmentReason.ts@@ -19,4 +19,3 @@ export const moduleLoader: ModuleLoader = {token,loadModule,};-diff --git a/packages/features/di/modules/BookingAccessService.ts b/packages/features/di/modules/BookingAccessService.tsindex 06cfe743bf4..a5f92aefa79 100644--- a/packages/features/di/modules/BookingAccessService.ts+++ b/packages/features/di/modules/BookingAccessService.ts@@ -19,5 +19,3 @@ export const moduleLoader: ModuleLoader = {token,loadModule,};--diff --git a/packages/features/di/modules/Credential.ts b/packages/features/di/modules/Credential.tsindex c3755417301..096f552ff04 100644--- a/packages/features/di/modules/Credential.ts+++ b/packages/features/di/modules/Credential.ts@@ -19,4 +19,3 @@ export const moduleLoader: ModuleLoader = {token,loadModule,};-diff --git a/packages/features/di/modules/Holiday.ts b/packages/features/di/modules/Holiday.tsindex 2fd7d973cea..7b4233fdcfc 100644--- a/packages/features/di/modules/Holiday.ts+++ b/packages/features/di/modules/Holiday.ts@@ -14,4 +14,3 @@ export const moduleLoader = {container.load(moduleToken, holidayRepositoryModule);},};-diff --git a/packages/features/di/modules/ManagedEventReassignment.ts b/packages/features/di/modules/ManagedEventReassignment.tsindex 9e5e894899b..f0fcf7199e2 100644--- a/packages/features/di/modules/ManagedEventReassignment.ts+++ b/packages/features/di/modules/ManagedEventReassignment.ts@@ -29,4 +29,3 @@ export const moduleLoader: ModuleLoader = {};export type { ManagedEventReassignmentService };-diff --git a/packages/features/di/shared/services/tasker.service.ts b/packages/features/di/shared/services/tasker.service.tsindex 0f90fea382c..5769ea7b12a 100644--- a/packages/features/di/shared/services/tasker.service.ts+++ b/packages/features/di/shared/services/tasker.service.ts@@ -20,4 +20,4 @@ const loadModule = (container: Container) => {export const moduleLoader = {token,loadModule,-};\ No newline at end of file+};diff --git a/packages/features/ee/api-keys/lib/autoLock.test.ts b/packages/features/ee/api-keys/lib/autoLock.test.tsindex 65f0bbff517..fb8cecf0e7f 100644--- a/packages/features/ee/api-keys/lib/autoLock.test.ts+++ b/packages/features/ee/api-keys/lib/autoLock.test.ts@@ -34,7 +34,9 @@ describe("autoLock", () => {beforeEach(() => {// Reset all mocks before each testvi.clearAllMocks();- vi.mocked(RedisService).mockImplementation(function() { return mockRedis as any; });+ vi.mocked(RedisService).mockImplementation(function () {+ return mockRedis as any;+ });// Mock environment variablesprocess.env.UPSTASH_REDIS_REST_TOKEN = "test-token";diff --git a/packages/features/ee/api-keys/services/ApiKeyService.ts b/packages/features/ee/api-keys/services/ApiKeyService.tsindex 2853359ce02..c19b9013b2c 100644--- a/packages/features/ee/api-keys/services/ApiKeyService.ts+++ b/packages/features/ee/api-keys/services/ApiKeyService.ts@@ -4,22 +4,24 @@ type Deps = {apiKeyRepo: PrismaApiKeyRepository;};-type VerifyKeyResult = {- valid: true;- userId: number;- user: {- uuid: string;- role: string;- locked: boolean;- email: string;- };-} | {- valid: false;- error: string;-}+type VerifyKeyResult =+ | {+ valid: true;+ userId: number;+ user: {+ uuid: string;+ role: string;+ locked: boolean;+ email: string;+ };+ }+ | {+ valid: false;+ error: string;+ };export class ApiKeyService {- constructor(private readonly deps: Deps) { }+ constructor(private readonly deps: Deps) {}async verifyKeyByHashedKey(hashedKey: string): Promise<VerifyKeyResult> {const apiKey = await this.deps.apiKeyRepo.findByHashedKey(hashedKey);diff --git a/packages/features/ee/billing/active-user/services/ActiveUserBillingService.ts b/packages/features/ee/billing/active-user/services/ActiveUserBillingService.tsindex 29a9e2fb583..6a6c143fc8d 100644--- a/packages/features/ee/billing/active-user/services/ActiveUserBillingService.ts+++ b/packages/features/ee/billing/active-user/services/ActiveUserBillingService.ts@@ -20,18 +20,15 @@ export class ActiveUserBillingService {periodEnd: Date): Promise<number> {const managedUserEmails =- await this.deps.activeUserBillingRepository.getManagedUserEmailsBySubscriptionId(- subscriptionId- );+ await this.deps.activeUserBillingRepository.getManagedUserEmailsBySubscriptionId(subscriptionId);if (managedUserEmails.length === 0) return 0;- const activeHosts =- await this.deps.activeUserBillingRepository.getActivePlatformUsersAsHost(- subscriptionId,- periodStart,- periodEnd- );+ const activeHosts = await this.deps.activeUserBillingRepository.getActivePlatformUsersAsHost(+ subscriptionId,+ periodStart,+ periodEnd+ );const activeHostEmails = new Set(activeHosts.map((h) => h.email));@@ -41,12 +38,11 @@ export class ActiveUserBillingService {if (nonHostEmails.length === 0) return activeHostEmails.size;- const activeAttendees =- await this.deps.activeUserBillingRepository.getActiveUsersAsAttendee(- nonHostEmails,- periodStart,- periodEnd- );+ const activeAttendees = await this.deps.activeUserBillingRepository.getActiveUsersAsAttendee(+ nonHostEmails,+ periodStart,+ periodEnd+ );return activeHostEmails.size + activeAttendees.length;}@@ -55,15 +51,8 @@ export class ActiveUserBillingService {* Count active users for a regular organization (uses org/team ID).* A user is "active" if they hosted or attended at least one booking in the period.*/- async getActiveUserCountForOrg(- orgId: number,- periodStart: Date,- periodEnd: Date- ): Promise<number> {- const memberEmails =- await this.deps.activeUserBillingRepository.getOrgMemberEmailsByOrgId(- orgId- );+ async getActiveUserCountForOrg(orgId: number, periodStart: Date, periodEnd: Date): Promise<number> {+ const memberEmails = await this.deps.activeUserBillingRepository.getOrgMemberEmailsByOrgId(orgId);return this.countActiveUsers(memberEmails.map((u) => u.email),@@ -79,27 +68,23 @@ export class ActiveUserBillingService {): Promise<number> {if (candidateEmails.length === 0) return 0;- const activeHosts =- await this.deps.activeUserBillingRepository.getActiveUsersAsHost(- candidateEmails,- periodStart,- periodEnd- );+ const activeHosts = await this.deps.activeUserBillingRepository.getActiveUsersAsHost(+ candidateEmails,+ periodStart,+ periodEnd+ );const activeHostEmails = new Set(activeHosts.map((h) => h.email));- const nonHostEmails = candidateEmails.filter(- (email) => !activeHostEmails.has(email)- );+ const nonHostEmails = candidateEmails.filter((email) => !activeHostEmails.has(email));if (nonHostEmails.length === 0) return activeHostEmails.size;- const activeAttendees =- await this.deps.activeUserBillingRepository.getActiveUsersAsAttendee(- nonHostEmails,- periodStart,- periodEnd- );+ const activeAttendees = await this.deps.activeUserBillingRepository.getActiveUsersAsAttendee(+ nonHostEmails,+ periodStart,+ periodEnd+ );return activeHostEmails.size + activeAttendees.length;}diff --git a/packages/features/ee/billing/api/webhook/__handler.test.ts b/packages/features/ee/billing/api/webhook/__handler.test.tsindex a9f1320a4bc..45ddcf7ff02 100644--- a/packages/features/ee/billing/api/webhook/__handler.test.ts+++ b/packages/features/ee/billing/api/webhook/__handler.test.ts@@ -30,7 +30,7 @@ describe("stripeWebhookHandler", () => {({headers,body,- } as unknown as NextApiRequest);+ }) as unknown as NextApiRequest;it("should throw an error if stripe-signature header is missing", async () => {const { req } = createMocks<CustomNextApiRequest, CustomNextApiResponse>({diff --git a/packages/features/ee/billing/api/webhook/_invoice.payment_failed.test.ts b/packages/features/ee/billing/api/webhook/_invoice.payment_failed.test.tsindex 9cc7ddb663f..d564ebb2107 100644--- a/packages/features/ee/billing/api/webhook/_invoice.payment_failed.test.ts+++ b/packages/features/ee/billing/api/webhook/_invoice.payment_failed.test.ts@@ -40,10 +40,7 @@ describe("invoice.payment_failed webhook", () => {expect(getPaymentIntentFailureReason).toHaveBeenCalledWith("pi_123");expect(createBySubscriptionId).toHaveBeenCalledWith("sub_123");- expect(onPaymentFailed).toHaveBeenCalledWith(- { lines: data.object.lines },- "card_declined"- );+ expect(onPaymentFailed).toHaveBeenCalledWith({ lines: data.object.lines }, "card_declined");expect(result).toEqual({ success: true, handled: true });});@@ -82,10 +79,7 @@ describe("invoice.payment_failed webhook", () => {const result = await handler(data);expect(getPaymentIntentFailureReason).not.toHaveBeenCalled();- expect(onPaymentFailed).toHaveBeenCalledWith(- { lines: data.object.lines },- "open"- );+ expect(onPaymentFailed).toHaveBeenCalledWith({ lines: data.object.lines }, "open");expect(result).toEqual({ success: true, handled: true });});});diff --git a/packages/features/ee/billing/api/webhook/_invoice.payment_failed.ts b/packages/features/ee/billing/api/webhook/_invoice.payment_failed.tsindex 81b17d4169c..8255b1e3a02 100644--- a/packages/features/ee/billing/api/webhook/_invoice.payment_failed.ts+++ b/packages/features/ee/billing/api/webhook/_invoice.payment_failed.ts@@ -1,4 +1,7 @@-import { getBillingProviderService, getSeatBillingStrategyFactory } from "@calcom/ee/billing/di/containers/Billing";+import {+ getBillingProviderService,+ getSeatBillingStrategyFactory,+} from "@calcom/ee/billing/di/containers/Billing";import logger from "@calcom/lib/logger";import type { SWHMap } from "./__handler";diff --git a/packages/features/ee/billing/api/webhook/hwm-webhook-utils.ts b/packages/features/ee/billing/api/webhook/hwm-webhook-utils.tsindex a4111ca8906..3b562b1ba30 100644--- a/packages/features/ee/billing/api/webhook/hwm-webhook-utils.ts+++ b/packages/features/ee/billing/api/webhook/hwm-webhook-utils.ts@@ -20,17 +20,13 @@ export function validateInvoiceLinesForHwm(log: Logger<unknown> = defaultLogger): { isValid: boolean; periodStart?: number } {if (!linesData || linesData.length === 0) {- log.warn(- `Invoice has no line items for subscription ${subscriptionId}, cannot process HWM`- );+ log.warn(`Invoice has no line items for subscription ${subscriptionId}, cannot process HWM`);return { isValid: false };}const periodStart = linesData[0]?.period?.start;if (!periodStart) {- log.warn(- `Invoice line item missing period.start for subscription ${subscriptionId}, cannot process HWM`- );+ log.warn(`Invoice line item missing period.start for subscription ${subscriptionId}, cannot process HWM`);return { isValid: false };}@@ -49,9 +45,7 @@ export async function handleHwmResetAfterRenewal(log: Logger<unknown> = defaultLogger): Promise<HwmResetResult> {if (!periodStartTimestamp) {- log.warn(- `No period start timestamp for subscription ${subscriptionId}, skipping HWM reset`- );+ log.warn(`No period start timestamp for subscription ${subscriptionId}, skipping HWM reset`);return { success: false, error: "No period start timestamp" };}diff --git a/packages/features/ee/billing/credit-service.test.ts b/packages/features/ee/billing/credit-service.test.tsindex 14a8565c76a..b790ae39abd 100644--- a/packages/features/ee/billing/credit-service.test.ts+++ b/packages/features/ee/billing/credit-service.test.ts@@ -469,7 +469,9 @@ describe("CreditService", () => {members: [{ accepted: true }],}),};- vi.mocked(TeamRepository).mockImplementation(function() { return mockTeamRepo as unknown as TeamRepository; });+ vi.mocked(TeamRepository).mockImplementation(function () {+ return mockTeamRepo as unknown as TeamRepository;+ });const mockTeamBillingService = {getSubscriptionStatus: vi.fn().mockResolvedValue(SubscriptionStatus.TRIALING),@@ -493,7 +495,9 @@ describe("CreditService", () => {members: [{ accepted: true }, { accepted: true }, { accepted: true }],}),};- vi.mocked(TeamRepository).mockImplementation(function() { return mockTeamRepo as unknown as TeamRepository; });+ vi.mocked(TeamRepository).mockImplementation(function () {+ return mockTeamRepo as unknown as TeamRepository;+ });const mockTeamBillingService = {getSubscriptionStatus: vi.fn().mockResolvedValue(SubscriptionStatus.ACTIVE),@@ -524,7 +528,9 @@ describe("CreditService", () => {members: [{ accepted: true }, { accepted: true }],}),};- vi.mocked(TeamRepository).mockImplementation(function() { return mockTeamRepo as unknown as TeamRepository; });+ vi.mocked(TeamRepository).mockImplementation(function () {+ return mockTeamRepo as unknown as TeamRepository;+ });const mockTeamBillingService = {getSubscriptionStatus: vi.fn().mockResolvedValue(SubscriptionStatus.ACTIVE),@@ -549,7 +555,9 @@ describe("CreditService", () => {members: [{ accepted: true }, { accepted: true }, { accepted: true }],}),};- vi.mocked(TeamRepository).mockImplementation(function() { return mockTeamRepo as unknown as TeamRepository; });+ vi.mocked(TeamRepository).mockImplementation(function () {+ return mockTeamRepo as unknown as TeamRepository;+ });const mockTeamBillingService = {getSubscriptionStatus: vi.fn().mockResolvedValue(SubscriptionStatus.ACTIVE),@@ -842,9 +850,9 @@ describe("CreditService", () => {]);const mockTeamRepoInstance = {- findTeamsForCreditCheck: vi.fn().mockResolvedValue([- { id: 2, isOrganization: false, parentId: null, parent: null },- ]),+ findTeamsForCreditCheck: vi+ .fn()+ .mockResolvedValue([{ id: 2, isOrganization: false, parentId: null, parent: null }]),};vi.mocked(TeamRepository).mockImplementation(function () {return mockTeamRepoInstance as unknown as TeamRepository;@@ -960,9 +968,9 @@ describe("CreditService", () => {]);const mockTeamRepoInstance = {- findTeamsForCreditCheck: vi.fn().mockResolvedValue([- { id: 2, isOrganization: false, parentId: null, parent: null },- ]),+ findTeamsForCreditCheck: vi+ .fn()+ .mockResolvedValue([{ id: 2, isOrganization: false, parentId: null, parent: null }]),};vi.mocked(TeamRepository).mockImplementation(function () {return mockTeamRepoInstance as unknown as TeamRepository;diff --git a/packages/features/ee/billing/repository/highWaterMark/HighWaterMarkRepository.ts b/packages/features/ee/billing/repository/highWaterMark/HighWaterMarkRepository.tsindex be42f930c91..277347d7c00 100644--- a/packages/features/ee/billing/repository/highWaterMark/HighWaterMarkRepository.ts+++ b/packages/features/ee/billing/repository/highWaterMark/HighWaterMarkRepository.ts@@ -74,9 +74,7 @@ export class HighWaterMarkRepository {if (!team) return null;- const billing = team.isOrganization- ? team.organizationBilling- : team.teamBilling;+ const billing = team.isOrganization ? team.organizationBilling : team.teamBilling;if (!billing) return null;return {@@ -85,9 +83,7 @@ export class HighWaterMarkRepository {};}- async getBySubscriptionId(- subscriptionId: string- ): Promise<HighWaterMarkBySubscriptionData | null> {+ async getBySubscriptionId(subscriptionId: string): Promise<HighWaterMarkBySubscriptionData | null> {// Try team billing firstconst teamBilling = await this.prisma.teamBilling.findUnique({where: { subscriptionId },@@ -170,9 +166,7 @@ export class HighWaterMarkRepository {throw new Error(`No team found for teamId ${teamId}`);}- const billing = isOrganization- ? team.organizationBilling- : team.teamBilling;+ const billing = isOrganization ? team.organizationBilling : team.teamBilling;if (!billing) {throw new Error(`No billing record found for team ${teamId}`);}@@ -181,13 +175,10 @@ export class HighWaterMarkRepository {const currentPeriodStart = billing.highWaterMarkPeriodStart;// Check if we're in a new period (period start changed)- const isNewPeriod =- !currentPeriodStart ||- periodStart.getTime() !== currentPeriodStart.getTime();+ const isNewPeriod = !currentPeriodStart || periodStart.getTime() !== currentPeriodStart.getTime();// If new period, always update. Otherwise, only update if higher.- const shouldUpdate =- isNewPeriod || currentHwm === null || newSeatCount > currentHwm;+ const shouldUpdate = isNewPeriod || currentHwm === null || newSeatCount > currentHwm;if (!shouldUpdate) {return { updated: false, previousHighWaterMark: currentHwm };diff --git a/packages/features/ee/billing/repository/proration/MonthlyProrationTeamRepository.ts b/packages/features/ee/billing/repository/proration/MonthlyProrationTeamRepository.tsindex 45c23aed90e..03f582f4b66 100644--- a/packages/features/ee/billing/repository/proration/MonthlyProrationTeamRepository.ts+++ b/packages/features/ee/billing/repository/proration/MonthlyProrationTeamRepository.ts@@ -70,9 +70,7 @@ export class MonthlyProrationTeamRepository {if (!team) return null;- let billing: BillingInfo | null = team.isOrganization- ? team.organizationBilling- : team.teamBilling;+ let billing: BillingInfo | null = team.isOrganization ? team.organizationBilling : team.teamBilling;if (!billing) {billing = this.extractBillingFromMetadata(team.metadata);diff --git a/packages/features/ee/billing/seed.ts b/packages/features/ee/billing/seed.tsindex a9939dedb99..a73d4b8183f 100644--- a/packages/features/ee/billing/seed.ts+++ b/packages/features/ee/billing/seed.ts@@ -124,7 +124,12 @@ async function main() {if (args.includes("--all")) {process.exit(await seedAll(args.includes("--cleanup")));}- if (args.includes("--cleanup") && !args.includes("--hwm") && !args.includes("--proration") && !args.includes("--all")) {+ if (+ args.includes("--cleanup") &&+ !args.includes("--hwm") &&+ !args.includes("--proration") &&+ !args.includes("--all")+ ) {process.exit(await cleanupAll());}diff --git a/packages/features/ee/billing/service/dueInvoice/seed-proration-test.ts b/packages/features/ee/billing/service/dueInvoice/seed-proration-test.tsindex a461489da5e..758fde9396b 100644--- a/packages/features/ee/billing/service/dueInvoice/seed-proration-test.ts+++ b/packages/features/ee/billing/service/dueInvoice/seed-proration-test.ts@@ -183,7 +183,10 @@ async function cleanupStripeResources(stripe: Stripe) {});for (const product of products.data) {- if ((product.name.startsWith("Proration Test") || product.name.startsWith("Trigger Test")) && product.active) {+ if (+ (product.name.startsWith("Proration Test") || product.name.startsWith("Trigger Test")) &&+ product.active+ ) {await stripe.products.update(product.id, { active: false });console.log(` Archived product: ${product.id}`);}diff --git a/packages/features/ee/billing/service/highWaterMark/__tests__/HighWaterMarkStripe.integration-test.ts b/packages/features/ee/billing/service/highWaterMark/__tests__/HighWaterMarkStripe.integration-test.tsindex a3a680de7e6..ef2c14cc5e5 100644--- a/packages/features/ee/billing/service/highWaterMark/__tests__/HighWaterMarkStripe.integration-test.ts+++ b/packages/features/ee/billing/service/highWaterMark/__tests__/HighWaterMarkStripe.integration-test.ts@@ -23,8 +23,7 @@ const STRIPE_PRIVATE_KEY = process.env.STRIPE_PRIVATE_KEY;const STRIPE_TEAM_MONTHLY_PRICE_ID = process.env.STRIPE_TEAM_MONTHLY_PRICE_ID;// Skip if Stripe is not configured-const describeIfStripe =- STRIPE_PRIVATE_KEY && STRIPE_TEAM_MONTHLY_PRICE_ID ? describe : describe.skip;+const describeIfStripe = STRIPE_PRIVATE_KEY && STRIPE_TEAM_MONTHLY_PRICE_ID ? describe : describe.skip;describeIfStripe("HighWaterMark Stripe E2E Test", () => {let stripe: Stripe;@@ -139,9 +138,7 @@ describeIfStripe("HighWaterMark Stripe E2E Test", () => {subscription = await stripe.subscriptions.create({customer: customer.id,- items: [- { price: STRIPE_TEAM_MONTHLY_PRICE_ID!, quantity: currentMemberCount },- ],+ items: [{ price: STRIPE_TEAM_MONTHLY_PRICE_ID!, quantity: currentMemberCount }],metadata: {testData: "true",teamId: testTeam.id.toString(),@@ -163,9 +160,7 @@ describeIfStripe("HighWaterMark Stripe E2E Test", () => {status: "ACTIVE",planName: "TEAM",highWaterMark: peakMemberCount,- highWaterMarkPeriodStart: new Date(- subscription.current_period_start * 1000- ),+ highWaterMarkPeriodStart: new Date(subscription.current_period_start * 1000),},});@@ -175,11 +170,7 @@ describeIfStripe("HighWaterMark Stripe E2E Test", () => {console.log(`HWM (Peak): ${peakMemberCount}`);console.log(`Subscription: ${subscription.id}`);console.log(`Test Clock: ${testClock.id}`);- console.log(- `Period End: ${new Date(- subscription.current_period_end * 1000- ).toISOString()}`- );+ console.log(`Period End: ${new Date(subscription.current_period_end * 1000).toISOString()}`);});afterAll(async () => {@@ -208,10 +199,7 @@ describeIfStripe("HighWaterMark Stripe E2E Test", () => {console.log("E2E Test cleanup complete");});- async function waitForClockAdvancement(- clockId: string,- maxWaitMs = 60000- ): Promise<void> {+ async function waitForClockAdvancement(clockId: string, maxWaitMs = 60000): Promise<void> {const startTime = Date.now();const pollIntervalMs = 2000;@@ -219,20 +207,12 @@ describeIfStripe("HighWaterMark Stripe E2E Test", () => {const clock = await stripe.testHelpers.testClocks.retrieve(clockId);if (clock.status === "ready") {- console.log(- `Test clock ready at: ${new Date(- clock.frozen_time * 1000- ).toISOString()}`- );+ console.log(`Test clock ready at: ${new Date(clock.frozen_time * 1000).toISOString()}`);return;}if (clock.status === "advancing") {- console.log(- `Clock still advancing... (${Math.round(- (Date.now() - startTime) / 1000- )}s elapsed)`- );+ console.log(`Clock still advancing... (${Math.round((Date.now() - startTime) / 1000)}s elapsed)`);await new Promise((resolve) => setTimeout(resolve, pollIntervalMs));continue;}@@ -257,11 +237,7 @@ describeIfStripe("HighWaterMark Stripe E2E Test", () => {return;}- console.log(- `Waiting for ${description}... (${Math.round(- (Date.now() - startTime) / 1000- )}s elapsed)`- );+ console.log(`Waiting for ${description}... (${Math.round((Date.now() - startTime) / 1000)}s elapsed)`);await new Promise((resolve) => setTimeout(resolve, pollIntervalMs));}@@ -295,21 +271,14 @@ describeIfStripe("HighWaterMark Stripe E2E Test", () => {where: { teamId: testTeam.id },select: { paidSeats: true, highWaterMark: true },});- console.log(- `Reset state: paidSeats=${resetBilling?.paidSeats}, HWM=${resetBilling?.highWaterMark}`- );+ console.log(`Reset state: paidSeats=${resetBilling?.paidSeats}, HWM=${resetBilling?.highWaterMark}`);expect(resetBilling?.paidSeats).toBe(4);expect(resetBilling?.highWaterMark).toBe(6);// Advance clock to 3 days before period end (triggers invoice.upcoming)- const invoiceUpcomingTime =- subscription.current_period_end - 3 * 24 * 60 * 60;- console.log(- `Advancing clock to: ${new Date(- invoiceUpcomingTime * 1000- ).toISOString()}`- );+ const invoiceUpcomingTime = subscription.current_period_end - 3 * 24 * 60 * 60;+ console.log(`Advancing clock to: ${new Date(invoiceUpcomingTime * 1000).toISOString()}`);await stripe.testHelpers.testClocks.advance(testClock.id, {frozen_time: invoiceUpcomingTime,@@ -320,9 +289,7 @@ describeIfStripe("HighWaterMark Stripe E2E Test", () => {// The webhook fires during clock advancement but fails because Stripe blocks// modifications while advancing. Now that clock is ready, manually trigger scale-up.- console.log(- "\\nManually triggering scale-up (webhook fails during clock advancement)..."- );+ console.log("\\nManually triggering scale-up (webhook fails during clock advancement)...");const billingService = new StripeBillingService(stripe);const hwmService = new HighWaterMarkService({@@ -347,9 +314,7 @@ describeIfStripe("HighWaterMark Stripe E2E Test", () => {}, 120000); // 2 minute timeoutit("should scale DOWN subscription quantity to current members after renewal", async () => {- console.log(- "\n=== Step 2: Advance clock past renewal to trigger scale down ==="- );+ console.log("\n=== Step 2: Advance clock past renewal to trigger scale down ===");// Get the updated subscription (period may have changed)const currentSub = await stripe.subscriptions.retrieve(subscription.id);@@ -357,12 +322,8 @@ describeIfStripe("HighWaterMark Stripe E2E Test", () => {// Advance clock past the billing period end (triggers renewal + subscription.updated)const renewalTime = periodEnd + 60; // 1 minute after period end- console.log(- `Current period end: ${new Date(periodEnd * 1000).toISOString()}`- );- console.log(- `Advancing clock to: ${new Date(renewalTime * 1000).toISOString()}`- );+ console.log(`Current period end: ${new Date(periodEnd * 1000).toISOString()}`);+ console.log(`Advancing clock to: ${new Date(renewalTime * 1000).toISOString()}`);await stripe.testHelpers.testClocks.advance(testClock.id, {frozen_time: renewalTime,@@ -372,16 +333,12 @@ describeIfStripe("HighWaterMark Stripe E2E Test", () => {await waitForClockAdvancement(testClock.id);// Debug: Check state immediately after clock advancement- const subAfterRenewal = await stripe.subscriptions.retrieve(- subscription.id- );+ const subAfterRenewal = await stripe.subscriptions.retrieve(subscription.id);console.log("Stripe subscription after renewal:");console.log(` - Status: ${subAfterRenewal.status}`);console.log(` - Quantity: ${subAfterRenewal.items.data[0].quantity}`);console.log(- ` - Period: ${new Date(- subAfterRenewal.current_period_start * 1000- ).toISOString()} to ${new Date(+ ` - Period: ${new Date(subAfterRenewal.current_period_start * 1000).toISOString()} to ${new Date(subAfterRenewal.current_period_end * 1000).toISOString()}`);@@ -397,9 +354,7 @@ describeIfStripe("HighWaterMark Stripe E2E Test", () => {// The webhook fires during clock advancement but fails because Stripe blocks// modifications while advancing. Now that clock is ready, manually trigger reset.// This simulates what would happen if we had retry logic or a separate job.- console.log(- "\\nManually triggering reset (webhook fails during clock advancement)..."- );+ console.log("\\nManually triggering reset (webhook fails during clock advancement)...");const billingService = new StripeBillingService(stripe);const hwmService = new HighWaterMarkService({@@ -407,9 +362,7 @@ describeIfStripe("HighWaterMark Stripe E2E Test", () => {billingService,});- const newPeriodStart = new Date(- subAfterRenewal.current_period_start * 1000- );+ const newPeriodStart = new Date(subAfterRenewal.current_period_start * 1000);await hwmService.resetSubscriptionAfterRenewal({subscriptionId: subscription.id,newPeriodStart,@@ -430,11 +383,7 @@ describeIfStripe("HighWaterMark Stripe E2E Test", () => {const updatedSub = await stripe.subscriptions.retrieve(subscription.id);expect(updatedSub.items.data[0].quantity).toBe(4);- console.log(- "Scale DOWN verified: subscription quantity = 4 (current members)"- );- console.log(- `Final state: paidSeats=${billing?.paidSeats}, HWM=${billing?.highWaterMark}`- );+ console.log("Scale DOWN verified: subscription quantity = 4 (current members)");+ console.log(`Final state: paidSeats=${billing?.paidSeats}, HWM=${billing?.highWaterMark}`);}, 180000); // 3 minute timeout});diff --git a/packages/features/ee/billing/service/highWaterMark/seed-hwm-test.ts b/packages/features/ee/billing/service/highWaterMark/seed-hwm-test.tsindex d6a787dba01..ddbe5bd80f9 100644--- a/packages/features/ee/billing/service/highWaterMark/seed-hwm-test.ts+++ b/packages/features/ee/billing/service/highWaterMark/seed-hwm-test.ts@@ -270,7 +270,12 @@ async function cleanupDatabaseResources() {console.log("Cleaning up database test resources...");// Delete test users (cascade will handle related records)- const testEmails = [HWM_TEAM_ADMIN_EMAIL, ...HWM_TEAM_MEMBER_EMAILS, HWM_ORG_ADMIN_EMAIL, ...HWM_ORG_MEMBER_EMAILS];+ const testEmails = [+ HWM_TEAM_ADMIN_EMAIL,+ ...HWM_TEAM_MEMBER_EMAILS,+ HWM_ORG_ADMIN_EMAIL,+ ...HWM_ORG_MEMBER_EMAILS,+ ];const deleteResult = await prisma.user.deleteMany({where: { email: { in: testEmails } },});@@ -445,7 +450,9 @@ async function seedHwmTeam(stripe: Stripe | null): Promise<TeamSeedResult> {},});- console.log(` TeamBilling created (MONTHLY, $${teamPricePerSeatCents / 100}/seat, ${paidSeats} paid, HWM=${peakMemberCount})`);+ console.log(+ ` TeamBilling created (MONTHLY, $${teamPricePerSeatCents / 100}/seat, ${paidSeats} paid, HWM=${peakMemberCount})`+ );// Get billing record for linking seat changesconst teamBilling = await prisma.teamBilling.findUnique({ where: { teamId: team.id } });@@ -654,7 +661,9 @@ async function seedHwmOrg(stripe: Stripe | null): Promise<OrgSeedResult> {},});- console.log(` OrganizationBilling created (MONTHLY, $${orgPricePerSeatCents / 100}/seat, ${paidSeats} paid, HWM=${peakMemberCount})`);+ console.log(+ ` OrganizationBilling created (MONTHLY, $${orgPricePerSeatCents / 100}/seat, ${paidSeats} paid, HWM=${peakMemberCount})`+ );// Get billing record for linking seat changesconst orgBilling = await prisma.organizationBilling.findUnique({ where: { teamId: org.id } });@@ -812,12 +821,8 @@ async function main() {const formatDate = (d: Date | null) => (d ? d.toISOString().split("T")[0] : "N/A");console.log("=== Summary Table ===\n");- console.log(- "| Entity | Qty | Members | HWM | invoice.upcoming | After Renewal | Price |"- );- console.log(- "|--------|-----|---------|-----|------------------|---------------|-------|"- );+ console.log("| Entity | Qty | Members | HWM | invoice.upcoming | After Renewal | Price |");+ console.log("|--------|-----|---------|-----|------------------|---------------|-------|");console.log(`| Team (ID:${result.team.team.id}) | ${result.team.paidSeats} | ${result.team.memberCount} | ${result.team.highWaterMark} | qty → ${result.team.highWaterMark} | qty → ${result.team.memberCount} (scale down) | $6.99 |`);@@ -826,8 +831,12 @@ async function main() {);console.log("\n=== Test Clock Dates ===\n");- console.log(` 1. Advance to ${formatDate(teamInvoiceUpcomingDate)} → triggers invoice.upcoming (scale UP to HWM)`);- console.log(` 2. Advance to ${formatDate(teamPeriodEnd)} → triggers renewal (scale DOWN to current members)`);+ console.log(+ ` 1. Advance to ${formatDate(teamInvoiceUpcomingDate)} → triggers invoice.upcoming (scale UP to HWM)`+ );+ console.log(+ ` 2. Advance to ${formatDate(teamPeriodEnd)} → triggers renewal (scale DOWN to current members)`+ );console.log("\n=== Stripe Resources ===\n");console.log("Team:");@@ -853,7 +862,9 @@ async function main() {console.log(" Or use Stripe CLI:");if (result.team.stripe.testClock) {const advanceTime = Math.floor(Date.now() / 1000) + 27 * 24 * 60 * 60;- console.log(` stripe test_clocks advance ${result.team.stripe.testClock.id} --frozen-time ${advanceTime}`);+ console.log(+ ` stripe test_clocks advance ${result.team.stripe.testClock.id} --frozen-time ${advanceTime}`+ );}console.log("");console.log("2. invoice.upcoming webhook flow:");@@ -875,8 +886,12 @@ async function main() {console.log(" - Org: subscription quantity reset from 8 to 6, HWM reset to 6");console.log("");console.log("5. To verify HWM in database:");- console.log(` SELECT "highWaterMark", "highWaterMarkPeriodStart", "paidSeats" FROM "TeamBilling" WHERE "teamId" = ${result.team.team.id};`);- console.log(` SELECT "highWaterMark", "highWaterMarkPeriodStart", "paidSeats" FROM "OrganizationBilling" WHERE "teamId" = ${result.organization.organization.id};`);+ console.log(+ ` SELECT "highWaterMark", "highWaterMarkPeriodStart", "paidSeats" FROM "TeamBilling" WHERE "teamId" = ${result.team.team.id};`+ );+ console.log(+ ` SELECT "highWaterMark", "highWaterMarkPeriodStart", "paidSeats" FROM "OrganizationBilling" WHERE "teamId" = ${result.organization.organization.id};`+ );console.log("");console.log("=== Cleanup ===\n");diff --git a/packages/features/ee/billing/service/proration/MonthlyProrationService.ts b/packages/features/ee/billing/service/proration/MonthlyProrationService.tsindex eb3476301bd..90aa80e8867 100644--- a/packages/features/ee/billing/service/proration/MonthlyProrationService.ts+++ b/packages/features/ee/billing/service/proration/MonthlyProrationService.ts@@ -66,7 +66,8 @@ export class MonthlyProrationService {async processMonthlyProrations(params: ProcessMonthlyProrationsParams) {const { monthKey, teamIds } = params;- const isFeatureEnabled = await this.featuresRepository.checkIfFeatureIsEnabledGlobally("monthly-proration");+ const isFeatureEnabled =+ await this.featuresRepository.checkIfFeatureIsEnabledGlobally("monthly-proration");if (!isFeatureEnabled) {this.logger.info("Monthly proration feature is not enabled, skipping batch processing", { monthKey });return [];@@ -400,7 +401,12 @@ export class MonthlyProrationService {await this.billingService.deleteInvoiceItem(invoiceItemId);}} catch (cleanupError) {- this.logger.error("Failed to clean up Stripe artifacts", { prorationId, invoiceId, invoiceItemId, error: cleanupError });+ this.logger.error("Failed to clean up Stripe artifacts", {+ prorationId,+ invoiceId,+ invoiceItemId,+ error: cleanupError,+ });}}diff --git a/packages/features/ee/billing/service/proration/ProrationEmailService.ts b/packages/features/ee/billing/service/proration/ProrationEmailService.tsindex 1f60a235cdb..3e01d389e99 100644--- a/packages/features/ee/billing/service/proration/ProrationEmailService.ts+++ b/packages/features/ee/billing/service/proration/ProrationEmailService.ts@@ -37,9 +37,7 @@ export class ProrationEmailService {async sendInvoiceEmail(params: SendInvoiceEmailParams): Promise<void> {const { prorationId, teamId, isAutoCharge } = params;- log.debug(- `Processing invoice email for prorationId ${prorationId}, teamId ${teamId}`- );+ log.debug(`Processing invoice email for prorationId ${prorationId}, teamId ${teamId}`);const proration = await this.prorationRepository.findForEmail(prorationId);if (!proration) {@@ -58,17 +56,13 @@ export class ProrationEmailService {}if (team.adminAndOwners.length === 0) {- log.warn(- `No users with billing permission found for team ${teamId}, skipping invoice email`- );+ log.warn(`No users with billing permission found for team ${teamId}, skipping invoice email`);return;}const invoiceUrl = await this.getInvoiceUrl(proration.invoiceId);- const { sendProrationInvoiceEmails } = await import(- "@calcom/emails/billing-email-service"- );+ const { sendProrationInvoiceEmails } = await import("@calcom/emails/billing-email-service");await sendProrationInvoiceEmails({team: { id: team.id, name: team.name },proration: {@@ -81,17 +75,13 @@ export class ProrationEmailService {adminAndOwners: team.adminAndOwners,});- log.debug(- `Successfully sent proration invoice emails for prorationId ${prorationId}`- );+ log.debug(`Successfully sent proration invoice emails for prorationId ${prorationId}`);}async sendReminderEmail(params: SendReminderEmailParams): Promise<void> {const { prorationId, teamId } = params;- log.debug(- `Processing reminder email for prorationId ${prorationId}, teamId ${teamId}`- );+ log.debug(`Processing reminder email for prorationId ${prorationId}, teamId ${teamId}`);const proration = await this.prorationRepository.findForEmail(prorationId);if (!proration) {@@ -100,9 +90,7 @@ export class ProrationEmailService {}if (proration.status === "CHARGED") {- log.debug(- `Proration ${prorationId} already charged, skipping reminder email`- );+ log.debug(`Proration ${prorationId} already charged, skipping reminder email`);return;}@@ -117,9 +105,7 @@ export class ProrationEmailService {}if (team.adminAndOwners.length === 0) {- log.warn(- `No users with billing permission found for team ${teamId}, skipping reminder email`- );+ log.warn(`No users with billing permission found for team ${teamId}, skipping reminder email`);return;}@@ -129,52 +115,41 @@ export class ProrationEmailService {"@calcom/emails/templates/proration-reminder-email");- const emailPromises = team.adminAndOwners.map(- async (user: UserWithBillingAccess) => {- const email = new ProrationReminderEmail({- user: {- name: user.name,- email: user.email,- t: user.t,- },- team: {- id: team.id,- name: team.name,- },- proration: {- monthKey: proration.monthKey,- netSeatIncrease: proration.netSeatIncrease,- proratedAmount: proration.proratedAmount,- },- invoiceUrl,- });- return email.sendEmail();- }- );+ const emailPromises = team.adminAndOwners.map(async (user: UserWithBillingAccess) => {+ const email = new ProrationReminderEmail({+ user: {+ name: user.name,+ email: user.email,+ t: user.t,+ },+ team: {+ id: team.id,+ name: team.name,+ },+ proration: {+ monthKey: proration.monthKey,+ netSeatIncrease: proration.netSeatIncrease,+ proratedAmount: proration.proratedAmount,+ },+ invoiceUrl,+ });+ return email.sendEmail();+ });await Promise.all(emailPromises);- log.debug(- `Successfully sent proration reminder emails for prorationId ${prorationId}`- );+ log.debug(`Successfully sent proration reminder emails for prorationId ${prorationId}`);}- private async getInvoiceUrl(- invoiceId: string | null- ): Promise<string | null> {+ private async getInvoiceUrl(invoiceId: string | null): Promise<string | null> {if (!invoiceId) return null;try {- const { default: stripe } = await import(- "@calcom/features/ee/payments/server/stripe"- );+ const { default: stripe } = await import("@calcom/features/ee/payments/server/stripe");const invoice = await stripe.invoices.retrieve(invoiceId);return invoice.hosted_invoice_url ?? null;} catch (error) {- log.warn(- `Failed to retrieve invoice URL for ${invoiceId}`,- safeStringify(error)- );+ log.warn(`Failed to retrieve invoice URL for ${invoiceId}`, safeStringify(error));return null;}}diff --git a/packages/features/ee/billing/service/proration/__tests__/MonthlyProrationService.integration-test.ts b/packages/features/ee/billing/service/proration/__tests__/MonthlyProrationService.integration-test.tsindex d5565b48e92..05eca3b5b7f 100644--- a/packages/features/ee/billing/service/proration/__tests__/MonthlyProrationService.integration-test.ts+++ b/packages/features/ee/billing/service/proration/__tests__/MonthlyProrationService.integration-test.ts@@ -26,14 +26,10 @@ function getTestDates() {}const mockBillingService: IBillingProviderService = {- createInvoiceItem: vi- .fn()- .mockResolvedValue({ invoiceItemId: "ii_test_123" }),+ createInvoiceItem: vi.fn().mockResolvedValue({ invoiceItemId: "ii_test_123" }),deleteInvoiceItem: vi.fn().mockResolvedValue(undefined),createInvoice: vi.fn().mockResolvedValue({ invoiceId: "in_test_123" }),- finalizeInvoice: vi- .fn()- .mockResolvedValue({ invoiceUrl: "https://invoice.stripe.com/test" }),+ finalizeInvoice: vi.fn().mockResolvedValue({ invoiceUrl: "https://invoice.stripe.com/test" }),getSubscription: vi.fn().mockResolvedValue({items: [{@@ -54,12 +50,8 @@ const mockBillingService: IBillingProviderService = {handleSubscriptionCancel: vi.fn().mockResolvedValue(undefined),handleSubscriptionCreation: vi.fn().mockResolvedValue(undefined),handleEndTrial: vi.fn().mockResolvedValue(undefined),- createCustomer: vi- .fn()- .mockResolvedValue({ stripeCustomerId: "cus_test_123" }),- createPaymentIntent: vi- .fn()- .mockResolvedValue({ id: "pi_test_123", client_secret: "secret_123" }),+ createCustomer: vi.fn().mockResolvedValue({ stripeCustomerId: "cus_test_123" }),+ createPaymentIntent: vi.fn().mockResolvedValue({ id: "pi_test_123", client_secret: "secret_123" }),createSubscriptionCheckout: vi.fn().mockResolvedValue({checkoutUrl: "https://checkout.test",sessionId: "cs_test_123",@@ -158,10 +150,7 @@ describe("MonthlyProrationService Integration Tests", () => {});it("should process end-to-end proration for annual team with seat additions", async () => {- const prorationService = new MonthlyProrationService(- undefined,- mockBillingService- );+ const prorationService = new MonthlyProrationService(undefined, mockBillingService);const timestamp = Date.now();const randomSuffix = Math.random().toString(36).substring(7);@@ -231,17 +220,12 @@ describe("MonthlyProrationService Integration Tests", () => {});expect(seatChanges).toHaveLength(2);- expect(- seatChanges.every((sc) => sc.processedInProrationId === proration?.id)- ).toBe(true);+ expect(seatChanges.every((sc) => sc.processedInProrationId === proration?.id)).toBe(true);});it("should create a $0 proration for team with no net change", async () => {const seatTracker = new SeatChangeTrackingService();- const prorationService = new MonthlyProrationService(- undefined,- mockBillingService- );+ const prorationService = new MonthlyProrationService(undefined, mockBillingService);await seatTracker.logSeatAddition({teamId: testTeam.id,@@ -344,21 +328,14 @@ describe("MonthlyProrationService Integration Tests", () => {monthKey,});- const filteredResults = results.filter((r) =>- [testTeam.id, testTeam2.id].includes(r.teamId)- );+ const filteredResults = results.filter((r) => [testTeam.id, testTeam2.id].includes(r.teamId));expect(filteredResults).toHaveLength(2);- expect(filteredResults.every((r) => r.status === "INVOICE_CREATED")).toBe(- true- );+ expect(filteredResults.every((r) => r.status === "INVOICE_CREATED")).toBe(true);});it("should handle payment success callback", async () => {const seatTracker = new SeatChangeTrackingService();- const prorationService = new MonthlyProrationService(- undefined,- mockBillingService- );+ const prorationService = new MonthlyProrationService(undefined, mockBillingService);await seatTracker.logSeatAddition({teamId: testTeam.id,@@ -387,10 +364,7 @@ describe("MonthlyProrationService Integration Tests", () => {it("should handle payment failure callback", async () => {const seatTracker = new SeatChangeTrackingService();- const prorationService = new MonthlyProrationService(- undefined,- mockBillingService- );+ const prorationService = new MonthlyProrationService(undefined, mockBillingService);await seatTracker.logSeatAddition({teamId: testTeam.id,@@ -422,10 +396,7 @@ describe("MonthlyProrationService Integration Tests", () => {it("should call handleSubscriptionUpdate when updating subscription quantity", async () => {const seatTracker = new SeatChangeTrackingService();- const prorationService = new MonthlyProrationService(- undefined,- mockBillingService- );+ const prorationService = new MonthlyProrationService(undefined, mockBillingService);// Reset the mock to track callsvi.mocked(mockBillingService.handleSubscriptionUpdate).mockClear();@@ -460,14 +431,9 @@ describe("MonthlyProrationService Integration Tests", () => {const seatTracker = new SeatChangeTrackingService();const failingBillingService = {...mockBillingService,- handleSubscriptionUpdate: vi- .fn()- .mockRejectedValue(new Error("Subscription not found")),+ handleSubscriptionUpdate: vi.fn().mockRejectedValue(new Error("Subscription not found")),};- const prorationService = new MonthlyProrationService(- undefined,- failingBillingService- );+ const prorationService = new MonthlyProrationService(undefined, failingBillingService);await seatTracker.logSeatAddition({teamId: testTeam.id,@@ -483,8 +449,8 @@ describe("MonthlyProrationService Integration Tests", () => {});// Should throw when trying to update subscription- await expect(- prorationService.handleProrationPaymentSuccess(proration!.id)- ).rejects.toThrow("Subscription not found");+ await expect(prorationService.handleProrationPaymentSuccess(proration!.id)).rejects.toThrow(+ "Subscription not found"+ );});});diff --git a/packages/features/ee/billing/service/proration/tasker/ProrationEmailSyncTasker.ts b/packages/features/ee/billing/service/proration/tasker/ProrationEmailSyncTasker.tsindex 3971c8fdce9..e4a83625422 100644--- a/packages/features/ee/billing/service/proration/tasker/ProrationEmailSyncTasker.ts+++ b/packages/features/ee/billing/service/proration/tasker/ProrationEmailSyncTasker.ts@@ -28,10 +28,9 @@ export class ProrationEmailSyncTasker implements IProrationEmailTasker {const runId = `sync_${nanoid(10)}`;// In sync mode, reminders are not scheduled (they require Trigger.dev)// so cancellation is a no-op- this.logger.info(- `[ProrationEmailSyncTasker] cancelReminder runId=${runId} - no-op in sync mode`,- { prorationId: payload.prorationId }- );+ this.logger.info(`[ProrationEmailSyncTasker] cancelReminder runId=${runId} - no-op in sync mode`, {+ prorationId: payload.prorationId,+ });return { runId };}}diff --git a/packages/features/ee/billing/service/proration/tasker/trigger/scheduleMonthlyProration.ts b/packages/features/ee/billing/service/proration/tasker/trigger/scheduleMonthlyProration.tsindex f8b73103c2c..0b9d0f32bae 100644--- a/packages/features/ee/billing/service/proration/tasker/trigger/scheduleMonthlyProration.ts+++ b/packages/features/ee/billing/service/proration/tasker/trigger/scheduleMonthlyProration.ts@@ -13,24 +13,18 @@ export const scheduleMonthlyProration = schedules.task({run: async (payload) => {const { subMonths } = await import("date-fns");const { TriggerDevLogger } = await import("@calcom/lib/triggerDevLogger");- const { formatMonthKey, isValidMonthKey } = await import(- "@calcom/features/ee/billing/lib/month-key"- );+ const { formatMonthKey, isValidMonthKey } = await import("@calcom/features/ee/billing/lib/month-key");const { MonthlyProrationTeamRepository } = await import("@calcom/features/ee/billing/repository/proration/MonthlyProrationTeamRepository");- const { getFeaturesRepository } = await import(- "@calcom/features/di/containers/FeaturesRepository"- );+ const { getFeaturesRepository } = await import("@calcom/features/di/containers/FeaturesRepository");const triggerDevLogger = new TriggerDevLogger();const log = triggerDevLogger.getSubLogger({name: "MonthlyProrationSchedule",});const featuresRepository = getFeaturesRepository();- const isEnabled = await featuresRepository.checkIfFeatureIsEnabledGlobally(- "monthly-proration"- );+ const isEnabled = await featuresRepository.checkIfFeatureIsEnabledGlobally("monthly-proration");if (!isEnabled) {log.info("Monthly proration feature is disabled");@@ -38,9 +32,7 @@ export const scheduleMonthlyProration = schedules.task({}const externalIdMonthKey =- payload.externalId && isValidMonthKey(payload.externalId)- ? payload.externalId- : null;+ payload.externalId && isValidMonthKey(payload.externalId) ? payload.externalId : null;let monthKey: string;if (externalIdMonthKey) {@@ -48,9 +40,7 @@ export const scheduleMonthlyProration = schedules.task({log.info(`Using monthKey from externalId: ${monthKey}`);} else {const now = new Date();- const startOfCurrentMonthUtc = new Date(- Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), 1)- );+ const startOfCurrentMonthUtc = new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), 1));const previousMonthUtc = subMonths(startOfCurrentMonthUtc, 1);monthKey = formatMonthKey(previousMonthUtc);}@@ -58,9 +48,7 @@ export const scheduleMonthlyProration = schedules.task({log.info(`Starting monthly proration for ${monthKey}`);const teamRepository = new MonthlyProrationTeamRepository();- const teamIdsList = await teamRepository.getAnnualTeamsWithSeatChanges(- monthKey- );+ const teamIdsList = await teamRepository.getAnnualTeamsWithSeatChanges(monthKey);if (teamIdsList.length === 0) {log.info(`No teams with seat changes found for ${monthKey}`);diff --git a/packages/features/ee/billing/service/seatBillingStrategy/SeatBillingStrategyFactory.ts b/packages/features/ee/billing/service/seatBillingStrategy/SeatBillingStrategyFactory.tsindex 7a42872fffa..54ef46e2f8c 100644--- a/packages/features/ee/billing/service/seatBillingStrategy/SeatBillingStrategyFactory.ts+++ b/packages/features/ee/billing/service/seatBillingStrategy/SeatBillingStrategyFactory.ts@@ -41,23 +41,16 @@ export class SeatBillingStrategyFactory {}async createByTeamId(teamId: number): Promise<ISeatBillingStrategy> {- const info = await this.deps.billingPeriodService.getBillingPeriodInfo(- teamId- );+ const info = await this.deps.billingPeriodService.getBillingPeriodInfo(teamId);if (!info.isInTrial && info.subscriptionStart) {if (info.billingPeriod === "ANNUALLY") {const enabled =- await this.deps.featuresRepository.checkIfFeatureIsEnabledGlobally(- "monthly-proration"- );+ await this.deps.featuresRepository.checkIfFeatureIsEnabledGlobally("monthly-proration");if (enabled) return this.prorationStrategy;}if (info.billingPeriod === "MONTHLY") {- const enabled =- await this.deps.featuresRepository.checkIfFeatureIsEnabledGlobally(- "hwm-seating"- );+ const enabled = await this.deps.featuresRepository.checkIfFeatureIsEnabledGlobally("hwm-seating");if (enabled) return this.hwmStrategy;}}@@ -65,16 +58,10 @@ export class SeatBillingStrategyFactory {return this.fallback;}- async createBySubscriptionId(- subscriptionId: string- ): Promise<ISeatBillingStrategy> {- const team = await this.deps.teamBillingDataRepository.findBySubscriptionId(- subscriptionId- );+ async createBySubscriptionId(subscriptionId: string): Promise<ISeatBillingStrategy> {+ const team = await this.deps.teamBillingDataRepository.findBySubscriptionId(subscriptionId);if (!team) {- log.warn(- `No team found for subscription ${subscriptionId}, using fallback strategy`- );+ log.warn(`No team found for subscription ${subscriptionId}, using fallback strategy`);return this.fallback;}return this.createByTeamId(team.id);diff --git a/packages/features/ee/billing/service/seatBillingStrategy/__tests__/SeatBillingStrategyFactory.test.ts b/packages/features/ee/billing/service/seatBillingStrategy/__tests__/SeatBillingStrategyFactory.test.tsindex 17270db6398..7eb15f95f42 100644--- a/packages/features/ee/billing/service/seatBillingStrategy/__tests__/SeatBillingStrategyFactory.test.ts+++ b/packages/features/ee/billing/service/seatBillingStrategy/__tests__/SeatBillingStrategyFactory.test.ts@@ -99,10 +99,7 @@ describe("SeatBillingStrategyFactory", () => {});it("returns HighWaterMarkStrategy for monthly plan with HWM enabled", async () => {- const factory = createFactory(- { ...baseBillingInfo, billingPeriod: "MONTHLY" },- { "hwm-seating": true }- );+ const factory = createFactory({ ...baseBillingInfo, billingPeriod: "MONTHLY" }, { "hwm-seating": true });const strategy = await factory.createByTeamId(1);expect(strategy).toBeInstanceOf(HighWaterMarkStrategy);@@ -119,10 +116,7 @@ describe("SeatBillingStrategyFactory", () => {});it("returns ImmediateUpdateStrategy for monthly plan with HWM disabled", async () => {- const factory = createFactory(- { ...baseBillingInfo, billingPeriod: "MONTHLY" },- { "hwm-seating": false }- );+ const factory = createFactory({ ...baseBillingInfo, billingPeriod: "MONTHLY" }, { "hwm-seating": false });const strategy = await factory.createByTeamId(1);expect(strategy).toBeInstanceOf(ImmediateUpdateStrategy);diff --git a/packages/features/ee/billing/service/teams/ITeamBillingService.ts b/packages/features/ee/billing/service/teams/ITeamBillingService.tsindex 5077a176384..6b2bdc83ad3 100644--- a/packages/features/ee/billing/service/teams/ITeamBillingService.ts+++ b/packages/features/ee/billing/service/teams/ITeamBillingService.ts@@ -1,6 +1,9 @@import type { Team } from "@calcom/prisma/client";-import type { IBillingRepositoryCreateArgs, SubscriptionStatus } from "../../repository/billing/IBillingRepository";+import type {+ IBillingRepositoryCreateArgs,+ SubscriptionStatus,+} from "../../repository/billing/IBillingRepository";import type { SeatChangeType } from "../seatBillingStrategy/ISeatBillingStrategy";export type TeamBillingInput = Pick<Team, "id" | "parentId" | "metadata" | "isOrganization">;diff --git a/packages/features/ee/dsync/lib/assignValueToUser.ts b/packages/features/ee/dsync/lib/assignValueToUser.tsindex 4b4fbaa9f13..21207c810ba 100644--- a/packages/features/ee/dsync/lib/assignValueToUser.ts+++ b/packages/features/ee/dsync/lib/assignValueToUser.ts@@ -312,7 +312,7 @@ const buildPrismaQueryForAttributeOptionCreation = ({};const createMissingOptionsAndReturnAlongWithExisting = async <- TattributeOptionsToAssign extends AttributeOptionsToAssign+ TattributeOptionsToAssign extends AttributeOptionsToAssign,>({attributeOptionsToAssignIncludingNonExistentOptions,orgId,diff --git a/packages/features/ee/dsync/lib/handleUserEvents.test.ts b/packages/features/ee/dsync/lib/handleUserEvents.test.tsindex 42a592d7718..a13fe2071f9 100644--- a/packages/features/ee/dsync/lib/handleUserEvents.test.ts+++ b/packages/features/ee/dsync/lib/handleUserEvents.test.ts@@ -48,9 +48,11 @@ vi.mock("./removeUserFromOrg", () => ({}));vi.mock("@calcom/features/users/repositories/UserRepository", () => ({- UserRepository: vi.fn().mockImplementation(function() { return {- isAMemberOfOrganization: vi.fn().mockResolvedValue(false),- }; }),+ UserRepository: vi.fn().mockImplementation(function () {+ return {+ isAMemberOfOrganization: vi.fn().mockResolvedValue(false),+ };+ }),}));async function createMockOrganization({ id, name, slug }: { id: number; name: string; slug: string }) {diff --git a/packages/features/ee/integration-attribute-sync/di/AttributeSyncRuleService.container.ts b/packages/features/ee/integration-attribute-sync/di/AttributeSyncRuleService.container.tsindex c123000ccc5..dbcbead9e60 100644--- a/packages/features/ee/integration-attribute-sync/di/AttributeSyncRuleService.container.ts+++ b/packages/features/ee/integration-attribute-sync/di/AttributeSyncRuleService.container.ts@@ -10,5 +10,7 @@ const attributeSyncRuleServiceContainer = createContainer();export function getAttributeSyncRuleService(): AttributeSyncRuleService {attributeSyncRuleServiceModule.loadModule(attributeSyncRuleServiceContainer);- return attributeSyncRuleServiceContainer.get<AttributeSyncRuleService>(attributeSyncRuleServiceModule.token);+ return attributeSyncRuleServiceContainer.get<AttributeSyncRuleService>(+ attributeSyncRuleServiceModule.token+ );}diff --git a/packages/features/ee/integration-attribute-sync/repositories/IIntegrationAttributeSyncRepository.ts b/packages/features/ee/integration-attribute-sync/repositories/IIntegrationAttributeSyncRepository.tsindex 31be6a54f4a..fe571fa50b1 100644--- a/packages/features/ee/integration-attribute-sync/repositories/IIntegrationAttributeSyncRepository.ts+++ b/packages/features/ee/integration-attribute-sync/repositories/IIntegrationAttributeSyncRepository.ts@@ -123,31 +123,15 @@ export interface IUpdateAttributeSyncInput {}export interface IIntegrationAttributeSyncRepository {- getByOrganizationId(- organizationId: number- ): Promise<IntegrationAttributeSync[]>;+ getByOrganizationId(organizationId: number): Promise<IntegrationAttributeSync[]>;getById(id: string): Promise<IntegrationAttributeSync | null>;- getSyncFieldMappings(- integrationAttributeSyncId: string- ): Promise<AttributeSyncFieldMapping[]>;- getMappedAttributeIdsByOrganization(- organizationId: number,- excludeSyncId?: string- ): Promise<string[]>;- getAttributeIdsByOrganization(- organizationId: number,- attributeIds: string[]- ): Promise<string[]>;- create(- params: IIntegrationAttributeSyncCreateParams- ): Promise<IntegrationAttributeSync>;- updateTransactionWithRuleAndMappings(- params: IIntegrationAttributeSyncUpdateParams- ): Promise<void>;+ getSyncFieldMappings(integrationAttributeSyncId: string): Promise<AttributeSyncFieldMapping[]>;+ getMappedAttributeIdsByOrganization(organizationId: number, excludeSyncId?: string): Promise<string[]>;+ getAttributeIdsByOrganization(organizationId: number, attributeIds: string[]): Promise<string[]>;+ create(params: IIntegrationAttributeSyncCreateParams): Promise<IntegrationAttributeSync>;+ updateTransactionWithRuleAndMappings(params: IIntegrationAttributeSyncUpdateParams): Promise<void>;deleteById(id: string): Promise<void>;- getAllByCredentialId(- credentialId: number- ): Promise<IntegrationAttributeSync[]>;+ getAllByCredentialId(credentialId: number): Promise<IntegrationAttributeSync[]>;}export interface IIntegrationAttributeSyncUpdateParams {diff --git a/packages/features/ee/integration-attribute-sync/schemas/zod.test.ts b/packages/features/ee/integration-attribute-sync/schemas/zod.test.tsindex 71e45559caa..3a2a7e03d5d 100644--- a/packages/features/ee/integration-attribute-sync/schemas/zod.test.ts+++ b/packages/features/ee/integration-attribute-sync/schemas/zod.test.ts@@ -1,10 +1,6 @@import { describe, it, expect } from "vitest";-import {- attributeSyncRuleConditionSchema,- attributeSyncRuleSchema,- syncFormDataSchema,-} from "./zod";+import { attributeSyncRuleConditionSchema, attributeSyncRuleSchema, syncFormDataSchema } from "./zod";describe("attributeSyncRuleConditionSchema", () => {describe("team conditions", () => {diff --git a/packages/features/ee/integration-attribute-sync/schemas/zod.ts b/packages/features/ee/integration-attribute-sync/schemas/zod.tsindex 2741d5eb55f..deff5523d55 100644--- a/packages/features/ee/integration-attribute-sync/schemas/zod.ts+++ b/packages/features/ee/integration-attribute-sync/schemas/zod.ts@@ -38,8 +38,10 @@ const attributeConditionSchema = baseConditionSchema.extend({});// Discriminated union for conditions-export const attributeSyncRuleConditionSchema: z.ZodType<TAttributeSyncRuleCondition> =- z.discriminatedUnion("identifier", [teamConditionSchema, attributeConditionSchema]);+export const attributeSyncRuleConditionSchema: z.ZodType<TAttributeSyncRuleCondition> = z.discriminatedUnion(+ "identifier",+ [teamConditionSchema, attributeConditionSchema]+);export const attributeSyncRuleSchema: z.ZodType<IAttributeSyncRule> = z.object({operator: ruleOperatorSchema,diff --git a/packages/features/ee/integration-attribute-sync/services/AttributeSyncFieldMappingService.ts b/packages/features/ee/integration-attribute-sync/services/AttributeSyncFieldMappingService.tsindex 1eb42a1bf84..9159639dffc 100644--- a/packages/features/ee/integration-attribute-sync/services/AttributeSyncFieldMappingService.ts+++ b/packages/features/ee/integration-attribute-sync/services/AttributeSyncFieldMappingService.ts@@ -43,18 +43,14 @@ export class AttributeSyncFieldMappingService {});if (!membership) {- log.warn(- `No membership found for user ${userId} in org ${organizationId}`- );+ log.warn(`No membership found for user ${userId} in org ${organizationId}`);return;}const memberId = membership.id;const enabledSyncFieldMappings = syncFieldMappings.filter(- (mapping) =>- mapping.enabled &&- integrationFields[mapping.integrationFieldName] !== undefined+ (mapping) => mapping.enabled && integrationFields[mapping.integrationFieldName] !== undefined);if (enabledSyncFieldMappings.length === 0) {@@ -64,22 +60,20 @@ export class AttributeSyncFieldMappingService {const attributeIds = enabledSyncFieldMappings.map((m) => m.attributeId);- const attributes =- await this.deps.attributeRepository.findManyByIdsAndOrgIdWithOptions({- attributeIds,- orgId: organizationId,- });+ const attributes = await this.deps.attributeRepository.findManyByIdsAndOrgIdWithOptions({+ attributeIds,+ orgId: organizationId,+ });const attributeMap = new Map(attributes.map((a) => [a.id, a]));- const { attributeIdsToSync, optionsToCreate, assignmentsToCreate } =- this.processMappings({- enabledMappings: enabledSyncFieldMappings,- attributeMap,- integrationFields,- memberId,- orgId: organizationId,- });+ const { attributeIdsToSync, optionsToCreate, assignmentsToCreate } = this.processMappings({+ enabledMappings: enabledSyncFieldMappings,+ attributeMap,+ integrationFields,+ memberId,+ orgId: organizationId,+ });if (optionsToCreate.length > 0) {const newAssignments = await this.createOptionsAndGetAssignments({@@ -103,9 +97,7 @@ export class AttributeSyncFieldMappingService {if (assignmentsToCreate.length > 0) {await this.deps.attributeToUserRepository.createManySkipDuplicates(assignmentsToCreate);- log.info(- `Synced ${assignmentsToCreate.length} attribute(s) for member ${memberId}`- );+ log.info(`Synced ${assignmentsToCreate.length} attribute(s) for member ${memberId}`);}}@@ -156,9 +148,7 @@ export class AttributeSyncFieldMappingService {continue;}- const rawFieldValue = String(- integrationFields[mapping.integrationFieldName]- );+ const rawFieldValue = String(integrationFields[mapping.integrationFieldName]);if (hasOptions({ attribute })) {// SINGLE_SELECT / MULTI_SELECT - must find existing option@@ -243,12 +233,9 @@ export class AttributeSyncFieldMappingService {orgId,});- const optionLookup = new Map(- allOptions.map((o) => [`${o.attributeId}:${o.value.toLowerCase()}`, o])- );+ const optionLookup = new Map(allOptions.map((o) => [`${o.attributeId}:${o.value.toLowerCase()}`, o]));- const assignments: Array<{ memberId: number; attributeOptionId: string }> =- [];+ const assignments: Array<{ memberId: number; attributeOptionId: string }> = [];for (const newOption of optionsToCreate) {const key = `${newOption.attributeId}:${newOption.value.toLowerCase()}`;@@ -260,9 +247,7 @@ export class AttributeSyncFieldMappingService {attributeOptionId: createdOption.id,});} else {- log.error(- `Failed to find newly created option for attribute ${newOption.attributeId}`- );+ log.error(`Failed to find newly created option for attribute ${newOption.attributeId}`);}}diff --git a/packages/features/ee/integration-attribute-sync/services/AttributeSyncRuleService.ts b/packages/features/ee/integration-attribute-sync/services/AttributeSyncRuleService.tsindex 86c63c4c6e2..9e67f1d4784 100644--- a/packages/features/ee/integration-attribute-sync/services/AttributeSyncRuleService.ts+++ b/packages/features/ee/integration-attribute-sync/services/AttributeSyncRuleService.ts@@ -52,15 +52,12 @@ export class AttributeSyncRuleService {userId: number;teamConditions: ITeamCondition[];}) {- const userMemberships =- await this.deps.membershipRepository.findAllByUserId({- userId,- filters: { accepted: true },- });+ const userMemberships = await this.deps.membershipRepository.findAllByUserId({+ userId,+ filters: { accepted: true },+ });- const userTeamIdSet = new Set(- userMemberships.map((membership) => membership.teamId)- );+ const userTeamIdSet = new Set(userMemberships.map((membership) => membership.teamId));const teamConditionEvaluated: boolean[] = [];@@ -90,11 +87,10 @@ export class AttributeSyncRuleService {}): Promise<boolean[]> {const attributeService = getAttributeService();- const userAttributes =- await attributeService.getUsersAttributesByOrgMembershipId({- userId: user.id,- orgId: user.organizationId,- });+ const userAttributes = await attributeService.getUsersAttributesByOrgMembershipId({+ userId: user.id,+ orgId: user.organizationId,+ });const attributeConditionResults: boolean[] = [];@@ -114,10 +110,7 @@ export class AttributeSyncRuleService {const { operator } = condition;if (!userAttribute) {- if (- operator === ConditionOperatorEnum.IN ||- operator === ConditionOperatorEnum.EQUALS- ) {+ if (operator === ConditionOperatorEnum.IN || operator === ConditionOperatorEnum.EQUALS) {return false;}// For NOT_IN/NOT_EQUALS: user doesn't have attribute, condition passes@@ -125,17 +118,9 @@ export class AttributeSyncRuleService {}if (userAttribute.type === "MULTI_SELECT") {- return this.evaluateMultiSelectCondition(- userAttribute,- operator,- condition- );+ return this.evaluateMultiSelectCondition(userAttribute, operator, condition);} else {- return this.evaluateSingleValueCondition(- userAttribute,- operator,- condition- );+ return this.evaluateSingleValueCondition(userAttribute, operator, condition);}}@@ -149,14 +134,10 @@ export class AttributeSyncRuleService {switch (operator) {case ConditionOperatorEnum.IN:- return conditionAttributeOptionIds.every((id) =>- userAttributeOptionIds.has(id)- );+ return conditionAttributeOptionIds.every((id) => userAttributeOptionIds.has(id));case ConditionOperatorEnum.NOT_IN:- return !conditionAttributeOptionIds.some((id) =>- userAttributeOptionIds.has(id)- );+ return !conditionAttributeOptionIds.some((id) => userAttributeOptionIds.has(id));default:return false;@@ -164,10 +145,7 @@ export class AttributeSyncRuleService {}private evaluateSingleValueCondition(- userAttribute: Extract<- UserAttribute,- { type: "TEXT" | "NUMBER" | "SINGLE_SELECT" }- >,+ userAttribute: Extract<UserAttribute, { type: "TEXT" | "NUMBER" | "SINGLE_SELECT" }>,operator: ConditionOperatorEnum,condition: IAttributeCondition): boolean {@@ -175,13 +153,11 @@ export class AttributeSyncRuleService {// For TEXT/NUMBER: condition stores actual values, compare against value (case-insensitive)const isSingleSelect = userAttribute.type === "SINGLE_SELECT";- const userValue = isSingleSelect- ? userAttribute.optionId- : userAttribute.value?.toLowerCase() ?? null;+ const userValue = isSingleSelect ? userAttribute.optionId : (userAttribute.value?.toLowerCase() ?? null);const conditionValue = isSingleSelect- ? condition.value[0] ?? null- : condition.value[0]?.toLowerCase() ?? null;+ ? (condition.value[0] ?? null)+ : (condition.value[0]?.toLowerCase() ?? null);switch (operator) {case ConditionOperatorEnum.EQUALS:diff --git a/packages/features/ee/integration-attribute-sync/services/IntegrationAttributeSyncService.test.ts b/packages/features/ee/integration-attribute-sync/services/IntegrationAttributeSyncService.test.tsindex d3a5ced66fb..8340dded785 100644--- a/packages/features/ee/integration-attribute-sync/services/IntegrationAttributeSyncService.test.ts+++ b/packages/features/ee/integration-attribute-sync/services/IntegrationAttributeSyncService.test.ts@@ -180,14 +180,21 @@ describe("IntegrationAttributeSyncService", () => {};mockIntegrationAttributeSyncRepository.getMappedAttributeIdsByOrganization.mockResolvedValue([]);- mockIntegrationAttributeSyncRepository.getAttributeIdsByOrganization.mockResolvedValue(["attr-1", "attr-2"]);+ mockIntegrationAttributeSyncRepository.getAttributeIdsByOrganization.mockResolvedValue([+ "attr-1",+ "attr-2",+ ]);mockIntegrationAttributeSyncRepository.getSyncFieldMappings.mockResolvedValue([]);- mockIntegrationAttributeSyncRepository.updateTransactionWithRuleAndMappings.mockResolvedValue(undefined);+ mockIntegrationAttributeSyncRepository.updateTransactionWithRuleAndMappings.mockResolvedValue(+ undefined+ );mockTeamRepository.findTeamsNotBelongingToOrgByIds.mockResolvedValue([]);await service.updateIncludeRulesAndMappings(formData);- expect(mockIntegrationAttributeSyncRepository.updateTransactionWithRuleAndMappings).toHaveBeenCalledWith({+ expect(+ mockIntegrationAttributeSyncRepository.updateTransactionWithRuleAndMappings+ ).toHaveBeenCalledWith({integrationAttributeSync: {id: formData.id,name: formData.name,@@ -215,17 +222,24 @@ describe("IntegrationAttributeSyncService", () => {};mockIntegrationAttributeSyncRepository.getMappedAttributeIdsByOrganization.mockResolvedValue([]);- mockIntegrationAttributeSyncRepository.getAttributeIdsByOrganization.mockResolvedValue(["attr-1", "attr-2"]);+ mockIntegrationAttributeSyncRepository.getAttributeIdsByOrganization.mockResolvedValue([+ "attr-1",+ "attr-2",+ ]);mockIntegrationAttributeSyncRepository.getSyncFieldMappings.mockResolvedValue([{ id: "mapping-1", integrationFieldName: "field1", attributeId: "attr-1", enabled: true },{ id: "mapping-2", integrationFieldName: "field2", attributeId: "attr-2", enabled: true },]);- mockIntegrationAttributeSyncRepository.updateTransactionWithRuleAndMappings.mockResolvedValue(undefined);+ mockIntegrationAttributeSyncRepository.updateTransactionWithRuleAndMappings.mockResolvedValue(+ undefined+ );mockTeamRepository.findTeamsNotBelongingToOrgByIds.mockResolvedValue([]);await service.updateIncludeRulesAndMappings(formData);- expect(mockIntegrationAttributeSyncRepository.updateTransactionWithRuleAndMappings).toHaveBeenCalledWith({+ expect(+ mockIntegrationAttributeSyncRepository.updateTransactionWithRuleAndMappings+ ).toHaveBeenCalledWith({integrationAttributeSync: {id: formData.id,name: formData.name,@@ -258,12 +272,16 @@ describe("IntegrationAttributeSyncService", () => {{ id: "mapping-2", integrationFieldName: "field2", attributeId: "attr-2", enabled: true },{ id: "mapping-3", integrationFieldName: "field3", attributeId: "attr-3", enabled: true },]);- mockIntegrationAttributeSyncRepository.updateTransactionWithRuleAndMappings.mockResolvedValue(undefined);+ mockIntegrationAttributeSyncRepository.updateTransactionWithRuleAndMappings.mockResolvedValue(+ undefined+ );mockTeamRepository.findTeamsNotBelongingToOrgByIds.mockResolvedValue([]);await service.updateIncludeRulesAndMappings(formData);- expect(mockIntegrationAttributeSyncRepository.updateTransactionWithRuleAndMappings).toHaveBeenCalledWith({+ expect(+ mockIntegrationAttributeSyncRepository.updateTransactionWithRuleAndMappings+ ).toHaveBeenCalledWith({integrationAttributeSync: {id: formData.id,name: formData.name,@@ -291,17 +309,24 @@ describe("IntegrationAttributeSyncService", () => {};mockIntegrationAttributeSyncRepository.getMappedAttributeIdsByOrganization.mockResolvedValue([]);- mockIntegrationAttributeSyncRepository.getAttributeIdsByOrganization.mockResolvedValue(["attr-1", "attr-new"]);+ mockIntegrationAttributeSyncRepository.getAttributeIdsByOrganization.mockResolvedValue([+ "attr-1",+ "attr-new",+ ]);mockIntegrationAttributeSyncRepository.getSyncFieldMappings.mockResolvedValue([{ id: "mapping-1", integrationFieldName: "field1", attributeId: "attr-1", enabled: true },{ id: "mapping-2", integrationFieldName: "field2", attributeId: "attr-2", enabled: true },]);- mockIntegrationAttributeSyncRepository.updateTransactionWithRuleAndMappings.mockResolvedValue(undefined);+ mockIntegrationAttributeSyncRepository.updateTransactionWithRuleAndMappings.mockResolvedValue(+ undefined+ );mockTeamRepository.findTeamsNotBelongingToOrgByIds.mockResolvedValue([]);await service.updateIncludeRulesAndMappings(formData);- expect(mockIntegrationAttributeSyncRepository.updateTransactionWithRuleAndMappings).toHaveBeenCalledWith({+ expect(+ mockIntegrationAttributeSyncRepository.updateTransactionWithRuleAndMappings+ ).toHaveBeenCalledWith({integrationAttributeSync: {id: formData.id,name: formData.name,@@ -343,11 +368,15 @@ describe("IntegrationAttributeSyncService", () => {mockIntegrationAttributeSyncRepository.getMappedAttributeIdsByOrganization.mockResolvedValue([]);mockIntegrationAttributeSyncRepository.getAttributeIdsByOrganization.mockResolvedValue([]);mockIntegrationAttributeSyncRepository.getSyncFieldMappings.mockResolvedValue([]);- mockIntegrationAttributeSyncRepository.updateTransactionWithRuleAndMappings.mockResolvedValue(undefined);+ mockIntegrationAttributeSyncRepository.updateTransactionWithRuleAndMappings.mockResolvedValue(+ undefined+ );await service.updateIncludeRulesAndMappings(formData);- expect(mockIntegrationAttributeSyncRepository.updateTransactionWithRuleAndMappings).toHaveBeenCalledWith(+ expect(+ mockIntegrationAttributeSyncRepository.updateTransactionWithRuleAndMappings+ ).toHaveBeenCalledWith(expect.objectContaining({attributeSyncRule: {id: formData.ruleId,@@ -391,7 +420,9 @@ describe("IntegrationAttributeSyncService", () => {mockIntegrationAttributeSyncRepository.getAttributeIdsByOrganization.mockResolvedValue(["attr-1"]);mockIntegrationAttributeSyncRepository.getSyncFieldMappings.mockResolvedValue([]);- await expect(service.updateIncludeRulesAndMappings(formData)).rejects.toThrow(UnauthorizedAttributeError);+ await expect(service.updateIncludeRulesAndMappings(formData)).rejects.toThrow(+ UnauthorizedAttributeError+ );});it("should include invalid attribute ids in the error", async () => {@@ -410,7 +441,10 @@ describe("IntegrationAttributeSyncService", () => {await expect(service.updateIncludeRulesAndMappings(formData)).rejects.toSatisfy((error) => {expect(error).toBeInstanceOf(UnauthorizedAttributeError);- expect((error as UnauthorizedAttributeError).attributeIds).toEqual(["attr-invalid-1", "attr-invalid-2"]);+ expect((error as UnauthorizedAttributeError).attributeIds).toEqual([+ "attr-invalid-1",+ "attr-invalid-2",+ ]);return true;});});@@ -425,9 +459,14 @@ describe("IntegrationAttributeSyncService", () => {};mockIntegrationAttributeSyncRepository.getMappedAttributeIdsByOrganization.mockResolvedValue([]);- mockIntegrationAttributeSyncRepository.getAttributeIdsByOrganization.mockResolvedValue(["attr-1", "attr-2"]);+ mockIntegrationAttributeSyncRepository.getAttributeIdsByOrganization.mockResolvedValue([+ "attr-1",+ "attr-2",+ ]);mockIntegrationAttributeSyncRepository.getSyncFieldMappings.mockResolvedValue([]);- mockIntegrationAttributeSyncRepository.updateTransactionWithRuleAndMappings.mockResolvedValue(undefined);+ mockIntegrationAttributeSyncRepository.updateTransactionWithRuleAndMappings.mockResolvedValue(+ undefined+ );mockTeamRepository.findTeamsNotBelongingToOrgByIds.mockResolvedValue([]);await expect(service.updateIncludeRulesAndMappings(formData)).resolves.not.toThrow();@@ -442,7 +481,9 @@ describe("IntegrationAttributeSyncService", () => {mockIntegrationAttributeSyncRepository.getMappedAttributeIdsByOrganization.mockResolvedValue([]);mockIntegrationAttributeSyncRepository.getAttributeIdsByOrganization.mockResolvedValue([]);mockIntegrationAttributeSyncRepository.getSyncFieldMappings.mockResolvedValue([]);- mockIntegrationAttributeSyncRepository.updateTransactionWithRuleAndMappings.mockResolvedValue(undefined);+ mockIntegrationAttributeSyncRepository.updateTransactionWithRuleAndMappings.mockResolvedValue(+ undefined+ );mockTeamRepository.findTeamsNotBelongingToOrgByIds.mockResolvedValue([]);await expect(service.updateIncludeRulesAndMappings(formData)).resolves.not.toThrow();@@ -520,7 +561,9 @@ describe("IntegrationAttributeSyncService", () => {mockIntegrationAttributeSyncRepository.getMappedAttributeIdsByOrganization.mockResolvedValue([]);mockIntegrationAttributeSyncRepository.getAttributeIdsByOrganization.mockResolvedValue([]);mockIntegrationAttributeSyncRepository.getSyncFieldMappings.mockResolvedValue([]);- mockIntegrationAttributeSyncRepository.updateTransactionWithRuleAndMappings.mockResolvedValue(undefined);+ mockIntegrationAttributeSyncRepository.updateTransactionWithRuleAndMappings.mockResolvedValue(+ undefined+ );await service.updateIncludeRulesAndMappings(formData);@@ -546,7 +589,9 @@ describe("IntegrationAttributeSyncService", () => {mockIntegrationAttributeSyncRepository.getMappedAttributeIdsByOrganization.mockResolvedValue([]);mockIntegrationAttributeSyncRepository.getAttributeIdsByOrganization.mockResolvedValue([]);mockIntegrationAttributeSyncRepository.getSyncFieldMappings.mockResolvedValue([]);- mockIntegrationAttributeSyncRepository.updateTransactionWithRuleAndMappings.mockResolvedValue(undefined);+ mockIntegrationAttributeSyncRepository.updateTransactionWithRuleAndMappings.mockResolvedValue(+ undefined+ );await service.updateIncludeRulesAndMappings(formData);@@ -554,7 +599,9 @@ describe("IntegrationAttributeSyncService", () => {teamIds: [1, 2],orgId: 123,});- expect(mockIntegrationAttributeSyncRepository.updateTransactionWithRuleAndMappings).toHaveBeenCalled();+ expect(+ mockIntegrationAttributeSyncRepository.updateTransactionWithRuleAndMappings+ ).toHaveBeenCalled();});});});diff --git a/packages/features/ee/integration-attribute-sync/services/IntegrationAttributeSyncService.ts b/packages/features/ee/integration-attribute-sync/services/IntegrationAttributeSyncService.tsindex 3b111c9c68c..3d3ce371338 100644--- a/packages/features/ee/integration-attribute-sync/services/IntegrationAttributeSyncService.ts+++ b/packages/features/ee/integration-attribute-sync/services/IntegrationAttributeSyncService.ts@@ -51,37 +51,26 @@ export class IntegrationAttributeSyncService {private extractTeamIdsFromRule(rule: IAttributeSyncRule): number[] {return rule.conditions- .filter(- (c): c is ITeamCondition =>- c.identifier === ConditionIdentifierEnum.TEAM_ID- )+ .filter((c): c is ITeamCondition => c.identifier === ConditionIdentifierEnum.TEAM_ID).flatMap((c) => c.value);}- private async validateTeamsBelongToOrg(- teamIds: number[],- organizationId: number- ): Promise<void> {+ private async validateTeamsBelongToOrg(teamIds: number[], organizationId: number): Promise<void> {if (teamIds.length === 0) return;- const invalidTeams =- await this.deps.teamRepository.findTeamsNotBelongingToOrgByIds({- teamIds,- orgId: organizationId,- });+ const invalidTeams = await this.deps.teamRepository.findTeamsNotBelongingToOrgByIds({+ teamIds,+ orgId: organizationId,+ });if (invalidTeams.length > 0) {throw new Error(- `Teams do not belong to this organization: ${invalidTeams- .map((t) => t.id)- .join(", ")}`+ `Teams do not belong to this organization: ${invalidTeams.map((t) => t.id).join(", ")}`);}}- private validateWithinSyncUniqueness(- mappings: { attributeId: string }[]- ): void {+ private validateWithinSyncUniqueness(mappings: { attributeId: string }[]): void {const seenAttributes = new Set<string>();for (const mapping of mappings) {if (seenAttributes.has(mapping.attributeId)) {@@ -110,10 +99,7 @@ export class IntegrationAttributeSyncService {}}- private async validateAttributeOwnership(- organizationId: number,- attributeIds: string[]- ): Promise<void> {+ private async validateAttributeOwnership(organizationId: number, attributeIds: string[]): Promise<void> {const validAttributeIds =await this.deps.integrationAttributeSyncRepository.getAttributeIdsByOrganization(organizationId,@@ -135,19 +121,14 @@ export class IntegrationAttributeSyncService {}async getAllIntegrationAttributeSyncs(organizationId: number) {- return this.deps.integrationAttributeSyncRepository.getByOrganizationId(- organizationId- );+ return this.deps.integrationAttributeSyncRepository.getByOrganizationId(organizationId);}async getById(id: string) {return this.deps.integrationAttributeSyncRepository.getById(id);}- async createAttributeSync(- input: ZCreateAttributeSyncSchema,- organizationId: number- ) {+ async createAttributeSync(input: ZCreateAttributeSyncSchema, organizationId: number) {const credential = await this.deps.credentialRepository.findByIdAndTeamId({id: input.credentialId,teamId: organizationId,@@ -163,20 +144,13 @@ export class IntegrationAttributeSyncService {await this.validateTeamsBelongToOrg(teamIds, organizationId);const integrationValue = credential.app?.slug || credential.type;- if (- !Object.values(AttributeSyncIntegrations).includes(- integrationValue as AttributeSyncIntegrations- )- ) {+ if (!Object.values(AttributeSyncIntegrations).includes(integrationValue as AttributeSyncIntegrations)) {throw new Error(`Unsupported integration type: ${integrationValue}`);}this.validateWithinSyncUniqueness(input.syncFieldMappings);- await this.validateCrossSyncUniqueness(- organizationId,- input.syncFieldMappings- );+ await this.validateCrossSyncUniqueness(organizationId, input.syncFieldMappings);const attributeIds = input.syncFieldMappings.map((m) => m.attributeId);await this.validateAttributeOwnership(organizationId, attributeIds);@@ -193,24 +167,18 @@ export class IntegrationAttributeSyncService {}async updateIncludeRulesAndMappings(data: ISyncFormData) {- const { syncFieldMappings, rule, ruleId, ...integrationAttributeSync } =- data;+ const { syncFieldMappings, rule, ruleId, ...integrationAttributeSync } = data;this.validateWithinSyncUniqueness(syncFieldMappings);- await this.validateCrossSyncUniqueness(- data.organizationId,- syncFieldMappings,- data.id- );+ await this.validateCrossSyncUniqueness(data.organizationId, syncFieldMappings, data.id);const attributeIds = syncFieldMappings.map((m) => m.attributeId);await this.validateAttributeOwnership(data.organizationId, attributeIds);- const existingFieldMappings =- await this.deps.integrationAttributeSyncRepository.getSyncFieldMappings(- data.id- );+ const existingFieldMappings = await this.deps.integrationAttributeSyncRepository.getSyncFieldMappings(+ data.id+ );const parsedRule = attributeSyncRuleSchema.parse(rule);@@ -229,30 +197,24 @@ export class IntegrationAttributeSyncService {.map((mapping) => mapping.id);const fieldMappingsToCreate = syncFieldMappings.filter((m) => !("id" in m));- const fieldMappingsToUpdate = syncFieldMappings.filter(- (m): m is typeof m & { id: string } => "id" in m- );-- await this.deps.integrationAttributeSyncRepository.updateTransactionWithRuleAndMappings(- {- integrationAttributeSync,- attributeSyncRule: {- id: ruleId,- rule: parsedRule,- },- fieldMappingsToCreate,- fieldMappingsToUpdate,- fieldMappingsToDelete,- }- );+ const fieldMappingsToUpdate = syncFieldMappings.filter((m): m is typeof m & { id: string } => "id" in m);++ await this.deps.integrationAttributeSyncRepository.updateTransactionWithRuleAndMappings({+ integrationAttributeSync,+ attributeSyncRule: {+ id: ruleId,+ rule: parsedRule,+ },+ fieldMappingsToCreate,+ fieldMappingsToUpdate,+ fieldMappingsToDelete,+ });}async deleteById(id: string) {return this.deps.integrationAttributeSyncRepository.deleteById(id);}async getAllByCredentialId(credentialId: number) {- return this.deps.integrationAttributeSyncRepository.getAllByCredentialId(- credentialId- );+ return this.deps.integrationAttributeSyncRepository.getAllByCredentialId(credentialId);}}diff --git a/packages/features/ee/managed-event-types/lib/handleChildrenEventTypes.ts b/packages/features/ee/managed-event-types/lib/handleChildrenEventTypes.tsindex fb2fa83291a..09f889ceac6 100644--- a/packages/features/ee/managed-event-types/lib/handleChildrenEventTypes.ts+++ b/packages/features/ee/managed-event-types/lib/handleChildrenEventTypes.ts@@ -288,7 +288,8 @@ export default async function handleChildrenEventTypes({disableRecordingForGuests: calVideoSettings.disableRecordingForGuests ?? false,disableRecordingForOrganizer: calVideoSettings.disableRecordingForOrganizer ?? false,enableAutomaticTranscription: calVideoSettings.enableAutomaticTranscription ?? false,- enableAutomaticRecordingForOrganizer: calVideoSettings.enableAutomaticRecordingForOrganizer ?? false,+ enableAutomaticRecordingForOrganizer:+ calVideoSettings.enableAutomaticRecordingForOrganizer ?? false,disableTranscriptionForGuests: calVideoSettings.disableTranscriptionForGuests ?? false,disableTranscriptionForOrganizer: calVideoSettings.disableTranscriptionForOrganizer ?? false,redirectUrlOnExit: calVideoSettings.redirectUrlOnExit ?? null,@@ -322,8 +323,8 @@ export default async function handleChildrenEventTypes({key === "afterBufferTime"? "afterEventBuffer": key === "beforeBufferTime"- ? "beforeEventBuffer"- : key;+ ? "beforeEventBuffer"+ : key;// @ts-expect-error Element implicitly has any typeacc[mappedKey] = true;return acc;@@ -474,7 +475,8 @@ export default async function handleChildrenEventTypes({enableAutomaticRecordingForOrganizer:calVideoSettings.enableAutomaticRecordingForOrganizer ?? false,disableTranscriptionForGuests: calVideoSettings.disableTranscriptionForGuests ?? false,- disableTranscriptionForOrganizer: calVideoSettings.disableTranscriptionForOrganizer ?? false,+ disableTranscriptionForOrganizer:+ calVideoSettings.disableTranscriptionForOrganizer ?? false,redirectUrlOnExit: calVideoSettings.redirectUrlOnExit ?? null,requireEmailForGuests: calVideoSettings.requireEmailForGuests ?? false,updatedAt: new Date(),@@ -487,7 +489,8 @@ export default async function handleChildrenEventTypes({enableAutomaticRecordingForOrganizer:calVideoSettings.enableAutomaticRecordingForOrganizer ?? false,disableTranscriptionForGuests: calVideoSettings.disableTranscriptionForGuests ?? false,- disableTranscriptionForOrganizer: calVideoSettings.disableTranscriptionForOrganizer ?? false,+ disableTranscriptionForOrganizer:+ calVideoSettings.disableTranscriptionForOrganizer ?? false,redirectUrlOnExit: calVideoSettings.redirectUrlOnExit ?? null,requireEmailForGuests: calVideoSettings.requireEmailForGuests ?? false,},diff --git a/packages/features/ee/managed-event-types/reassignment/index.ts b/packages/features/ee/managed-event-types/reassignment/index.tsindex 8a9ec5a3485..ef0213b9054 100644--- a/packages/features/ee/managed-event-types/reassignment/index.ts+++ b/packages/features/ee/managed-event-types/reassignment/index.ts@@ -1,4 +1,3 @@export { managedEventManualReassignment } from "./managedEventManualReassignment";export { managedEventReassignment } from "./managedEventReassignment";export * from "./utils";-diff --git a/packages/features/ee/managed-event-types/reassignment/managedEventManualReassignment.integration-test.ts b/packages/features/ee/managed-event-types/reassignment/managedEventManualReassignment.integration-test.tsindex abc9ad518f1..2731ae5533c 100644--- a/packages/features/ee/managed-event-types/reassignment/managedEventManualReassignment.integration-test.ts+++ b/packages/features/ee/managed-event-types/reassignment/managedEventManualReassignment.integration-test.ts@@ -468,7 +468,7 @@ describe("managedEventManualReassignment - Integration Tests", () => {const newBooking = await prisma.booking.findFirst({where: { userId: newUser.id, eventTypeId: childEventTypes[1].id },});-+expect(newBooking).toBeTruthy();expect(newBooking?.userId).toBe(newUser.id);});@@ -499,4 +499,3 @@ describe("managedEventManualReassignment - Integration Tests", () => {).rejects.toThrow();});});-diff --git a/packages/features/ee/managed-event-types/reassignment/managedEventManualReassignment.ts b/packages/features/ee/managed-event-types/reassignment/managedEventManualReassignment.tsindex 0434418886a..a10de2e4ccb 100644--- a/packages/features/ee/managed-event-types/reassignment/managedEventManualReassignment.ts+++ b/packages/features/ee/managed-event-types/reassignment/managedEventManualReassignment.ts@@ -5,7 +5,7 @@ import { createManagedEventManualReassignmentService } from "./services/containe/*** Entry point for manual managed event reassignment- *+ ** This delegates to the service layer without direct repository knowledge.* The container handles all dependency injection.*/diff --git a/packages/features/ee/managed-event-types/reassignment/managedEventReassignment.integration-test.ts b/packages/features/ee/managed-event-types/reassignment/managedEventReassignment.integration-test.tsindex fb687988902..00a7181c77d 100644--- a/packages/features/ee/managed-event-types/reassignment/managedEventReassignment.integration-test.ts+++ b/packages/features/ee/managed-event-types/reassignment/managedEventReassignment.integration-test.ts@@ -155,9 +155,9 @@ afterEach(async () => {},select: { id: true },});-+const testBookingIds = testBookings.map((b) => b.id);-+if (testBookingIds.length > 0) {await prisma.bookingReference.deleteMany({where: { bookingId: { in: testBookingIds } },@@ -172,7 +172,7 @@ afterEach(async () => {where: { id: { in: testBookingIds } },});}-+bookingIds.splice(0, bookingIds.length);if (eventTypeIds.length > 0) {@@ -393,7 +393,7 @@ describe("managedEventReassignment - Integration Tests", () => {const newBooking = await prisma.booking.findFirst({where: { userId: user2.id, startTime },});-+expect(newBooking).toBeTruthy();expect(newBooking?.userId).toBe(user2.id);});@@ -417,4 +417,3 @@ describe("managedEventReassignment - Integration Tests", () => {).rejects.toThrow();});});-diff --git a/packages/features/ee/managed-event-types/reassignment/managedEventReassignment.ts b/packages/features/ee/managed-event-types/reassignment/managedEventReassignment.tsindex 5a86c86a314..b9594bb0567 100644--- a/packages/features/ee/managed-event-types/reassignment/managedEventReassignment.ts+++ b/packages/features/ee/managed-event-types/reassignment/managedEventReassignment.ts@@ -27,4 +27,3 @@ export async function managedEventReassignment({}export default managedEventReassignment;-diff --git a/packages/features/ee/managed-event-types/reassignment/services/ManagedEventAssignmentReasonRecorder.ts b/packages/features/ee/managed-event-types/reassignment/services/ManagedEventAssignmentReasonRecorder.tsindex 09cf7c78bdb..9304f47f12b 100644--- a/packages/features/ee/managed-event-types/reassignment/services/ManagedEventAssignmentReasonRecorder.ts+++ b/packages/features/ee/managed-event-types/reassignment/services/ManagedEventAssignmentReasonRecorder.ts@@ -28,7 +28,7 @@ export class ManagedEventAssignmentReasonService {/*** Record a managed event reassignment reason- *+ ** @param newBookingId - The ID of the NEW booking created during reassignment* @param reassignById - The ID of the user who performed the reassignment* @param reassignReason - Optional reason for the reassignmentdiff --git a/packages/features/ee/managed-event-types/reassignment/services/ManagedEventManualReassignmentService.ts b/packages/features/ee/managed-event-types/reassignment/services/ManagedEventManualReassignmentService.tsindex a3d198e7080..b462c6818d5 100644--- a/packages/features/ee/managed-event-types/reassignment/services/ManagedEventManualReassignmentService.ts+++ b/packages/features/ee/managed-event-types/reassignment/services/ManagedEventManualReassignmentService.ts@@ -28,7 +28,6 @@ import logger from "@calcom/lib/logger";import type loggerType from "@calcom/lib/logger";import type { PrismaClient } from "@calcom/prisma";-import type { EventTypeMetadata } from "@calcom/prisma/zod-utils";import {@@ -111,7 +110,6 @@ export class ManagedEventManualReassignmentService {reassignedById,});-const { newBooking, cancelledBooking } = await this.executeBookingReassignmentTransaction({originalBookingFull,newBookingPlan,@@ -241,17 +239,13 @@ export class ManagedEventManualReassignmentService {* Resolves and validates all entities needed for reassignment*/private async resolveTargetEntities(bookingId: number, newUserId: number, reassignLogger: typeof logger) {- const {- currentChildEventType,- parentEventType,- targetChildEventType,- originalBooking,- } = await findTargetChildEventType({- bookingId,- newUserId,- bookingRepository: this.bookingRepository,- eventTypeRepository: this.eventTypeRepository,- });+ const { currentChildEventType, parentEventType, targetChildEventType, originalBooking } =+ await findTargetChildEventType({+ bookingId,+ newUserId,+ bookingRepository: this.bookingRepository,+ eventTypeRepository: this.eventTypeRepository,+ });reassignLogger.info("Found target child event type", {currentChildId: currentChildEventType.id,@@ -284,9 +278,8 @@ export class ManagedEventManualReassignmentService {throw new Error("Original booking user not found");}- const originalBookingFull = await this.bookingRepository.findByIdWithAttendeesPaymentAndReferences(- bookingId- );+ const originalBookingFull =+ await this.bookingRepository.findByIdWithAttendeesPaymentAndReferences(bookingId);if (!originalBookingFull) {throw new Error("Original booking not found");@@ -612,9 +605,7 @@ export class ManagedEventManualReassignmentService {data: {location: bookingLocation,metadata: {- ...(typeof newBooking.metadata === "object" && newBooking.metadata- ? newBooking.metadata- : {}),+ ...(typeof newBooking.metadata === "object" && newBooking.metadata ? newBooking.metadata : {}),...bookingMetadataUpdate,},referencesToCreate: referencesToCreateForDb,@@ -644,7 +635,6 @@ export class ManagedEventManualReassignmentService {};}-/*** Sends reassignment notification emails to all parties*/diff --git a/packages/features/ee/managed-event-types/reassignment/services/ManagedEventReassignmentService.ts b/packages/features/ee/managed-event-types/reassignment/services/ManagedEventReassignmentService.tsindex 1f23889670e..75c3a2b4696 100644--- a/packages/features/ee/managed-event-types/reassignment/services/ManagedEventReassignmentService.ts+++ b/packages/features/ee/managed-event-types/reassignment/services/ManagedEventReassignmentService.ts@@ -51,7 +51,7 @@ export class ManagedEventReassignmentService {this.luckyUserService = deps.luckyUserService;this.log = logger.getSubLogger({ prefix: ["ManagedEventReassignmentService"] });}-+async executeAutoReassignment({bookingId,orgId,@@ -216,4 +216,3 @@ export class ManagedEventReassignmentService {return luckyUser;}}-diff --git a/packages/features/ee/managed-event-types/reassignment/services/container.ts b/packages/features/ee/managed-event-types/reassignment/services/container.tsindex 4990a9efac1..e4e44353f61 100644--- a/packages/features/ee/managed-event-types/reassignment/services/container.ts+++ b/packages/features/ee/managed-event-types/reassignment/services/container.ts@@ -10,7 +10,7 @@ import { ManagedEventAssignmentReasonService } from "./ManagedEventAssignmentRea/*** Dependency Injection Container for Reassignment Services- *+ ** This ensures:* - Repositories are only instantiated once per request* - Services receive explicit dependencies via constructor@@ -97,4 +97,3 @@ export function createManagedEventReassignmentService(const container = new ReassignmentServiceContainer(prisma);return container.getManagedEventReassignmentService(luckyUserService);}-diff --git a/packages/features/ee/managed-event-types/reassignment/utils/buildNewBookingPlan.ts b/packages/features/ee/managed-event-types/reassignment/utils/buildNewBookingPlan.tsindex 647a091a83d..5712c114e40 100644--- a/packages/features/ee/managed-event-types/reassignment/utils/buildNewBookingPlan.ts+++ b/packages/features/ee/managed-event-types/reassignment/utils/buildNewBookingPlan.ts@@ -93,4 +93,3 @@ export function buildNewBookingPlan({iCalSequence: 0,};}-diff --git a/packages/features/ee/managed-event-types/reassignment/utils/findTargetChildEventType.ts b/packages/features/ee/managed-event-types/reassignment/utils/findTargetChildEventType.tsindex 478a929f653..9ac38b1df1e 100644--- a/packages/features/ee/managed-event-types/reassignment/utils/findTargetChildEventType.ts+++ b/packages/features/ee/managed-event-types/reassignment/utils/findTargetChildEventType.ts@@ -31,9 +31,9 @@ interface FindTargetChildEventTypeResult {/*** Pure function that finds and validates the target child event type for managed event reassignment- *+ ** Dependencies are injected via parameters - no direct instantiation of repositories- *+ ** @param bookingRepository - Injected booking repository* @param eventTypeRepository - Injected event type repository* @throws Error if booking is not on a managed event type@@ -77,12 +77,15 @@ export async function findTargetChildEventType({throw new Error("Parent event type must be a MANAGED type");}- const targetChildEventType = await eventTypeRepository.findByIdTargetChildEventType(newUserId, currentChildEventType.parentId);+ const targetChildEventType = await eventTypeRepository.findByIdTargetChildEventType(+ newUserId,+ currentChildEventType.parentId+ );if (!targetChildEventType) {throw new Error(`User ${newUserId} does not have a child event type for this managed event. ` +- `Only users who are assigned to the parent managed event can be reassigned to.`+ `Only users who are assigned to the parent managed event can be reassigned to.`);}@@ -109,4 +112,3 @@ export async function findTargetChildEventType({originalBooking: booking,};}-diff --git a/packages/features/ee/managed-event-types/reassignment/utils/validateManagedEventReassignment.ts b/packages/features/ee/managed-event-types/reassignment/utils/validateManagedEventReassignment.tsindex 3a345d44734..a8bf1b97bfc 100644--- a/packages/features/ee/managed-event-types/reassignment/utils/validateManagedEventReassignment.ts+++ b/packages/features/ee/managed-event-types/reassignment/utils/validateManagedEventReassignment.ts@@ -16,11 +16,9 @@ interface ValidateReassignmentResult {};}--/*** Validates that a booking can be reassigned- *+ ** @throws Error if booking is already cancelled* @throws Error if booking has already ended* @throws Error if booking is recurring (Phase 1 limitation)@@ -29,7 +27,6 @@ export async function validateManagedEventReassignment({bookingId,bookingRepository,}: ValidateReassignmentParams): Promise<ValidateReassignmentResult> {-const booking = await bookingRepository.findByIdForReassignmentValidation(bookingId);if (!booking) {@@ -45,11 +42,8 @@ export async function validateManagedEventReassignment({}if (booking.recurringEventId) {- throw new Error(- "Reassignment of recurring bookings is not yet supported for managed events"- );+ throw new Error("Reassignment of recurring bookings is not yet supported for managed events");}return { booking };}-diff --git a/packages/features/ee/organizations/__mocks__/organizationMock.ts b/packages/features/ee/organizations/__mocks__/organizationMock.tsindex b22cfd7870b..6b66a0e3c4c 100644--- a/packages/features/ee/organizations/__mocks__/organizationMock.ts+++ b/packages/features/ee/organizations/__mocks__/organizationMock.ts@@ -18,16 +18,14 @@ export const organizationScenarios = {findUniqueNonPlatformOrgsByMatchingAutoAcceptEmail: {// eslint-disable-next-line @typescript-eslint/no-explicit-anyfakeReturnOrganization: (org: any, forInput: any) => {- mockedSingleton.findUniqueNonPlatformOrgsByMatchingAutoAcceptEmail.mockImplementation(- (arg) => {- if (forInput.email === arg.email) {- return org;- }- const errorMsg = "Mock Error-fakeReturnOrganization: Unhandled input";- console.log(errorMsg, { arg, forInput });- throw new Error(errorMsg);+ mockedSingleton.findUniqueNonPlatformOrgsByMatchingAutoAcceptEmail.mockImplementation((arg) => {+ if (forInput.email === arg.email) {+ return org;}- );+ const errorMsg = "Mock Error-fakeReturnOrganization: Unhandled input";+ console.log(errorMsg, { arg, forInput });+ throw new Error(errorMsg);+ });},fakeNoMatch: () => {mockedSingleton.findUniqueNonPlatformOrgsByMatchingAutoAcceptEmail.mockResolvedValue(null);diff --git a/packages/features/ee/organizations/di/OrganizationMembershipService.module.ts b/packages/features/ee/organizations/di/OrganizationMembershipService.module.tsindex 22a2256e613..a469de17b86 100644--- a/packages/features/ee/organizations/di/OrganizationMembershipService.module.ts+++ b/packages/features/ee/organizations/di/OrganizationMembershipService.module.ts@@ -9,19 +9,18 @@ const token = ORGANIZATION_DI_TOKENS.ORGANIZATION_MEMBERSHIP_SERVICE;const moduleToken = ORGANIZATION_DI_TOKENS.ORGANIZATION_MEMBERSHIP_SERVICE_MODULE;const loadModule = bindModuleToClassOnToken({- module: thisModule,- moduleToken,- token,- classs: OrganizationMembershipService,- depsMap: {- organizationRepository: organizationRepositoryModuleLoader,- },+ module: thisModule,+ moduleToken,+ token,+ classs: OrganizationMembershipService,+ depsMap: {+ organizationRepository: organizationRepositoryModuleLoader,+ },});export const moduleLoader = {- token,- loadModule,+ token,+ loadModule,};export type { OrganizationMembershipService };-diff --git a/packages/features/ee/organizations/di/OrganizationRepository.module.ts b/packages/features/ee/organizations/di/OrganizationRepository.module.tsindex ba41eb1a7e9..f4a4c9d560a 100644--- a/packages/features/ee/organizations/di/OrganizationRepository.module.ts+++ b/packages/features/ee/organizations/di/OrganizationRepository.module.ts@@ -8,19 +8,18 @@ export const organizationRepositoryModule = createModule();const token = ORGANIZATION_DI_TOKENS.ORGANIZATION_REPOSITORY;const moduleToken = ORGANIZATION_DI_TOKENS.ORGANIZATION_REPOSITORY_MODULE;const loadModule = bindModuleToClassOnToken({- module: organizationRepositoryModule,- moduleToken,- token,- classs: OrganizationRepository,- depsMap: {- prismaClient: prismaModuleLoader,- },+ module: organizationRepositoryModule,+ moduleToken,+ token,+ classs: OrganizationRepository,+ depsMap: {+ prismaClient: prismaModuleLoader,+ },});export const moduleLoader: ModuleLoader = {- token,- loadModule,+ token,+ loadModule,};export type { OrganizationRepository };-diff --git a/packages/features/ee/organizations/di/tasker/tokens.ts b/packages/features/ee/organizations/di/tasker/tokens.tsindex 0e25ff0dd73..330287ac23f 100644--- a/packages/features/ee/organizations/di/tasker/tokens.ts+++ b/packages/features/ee/organizations/di/tasker/tokens.ts@@ -6,7 +6,9 @@ export const PLATFORM_BILLING_TASKER_DI_TOKENS = {PLATFORM_ORGANIZATION_BILLING_SYNC_TASKER: Symbol("PlatformOrganizationBillingSyncTasker"),PLATFORM_ORGANIZATION_BILLING_SYNC_TASKER_MODULE: Symbol("PlatformOrganizationBillingSyncTaskerModule"),PLATFORM_ORGANIZATION_BILLING_TRIGGER_TASKER: Symbol("PlatformOrganizationBillingTriggerTasker"),- PLATFORM_ORGANIZATION_BILLING_TRIGGER_TASKER_MODULE: Symbol("PlatformOrganizationBillingTriggerTaskerModule"),+ PLATFORM_ORGANIZATION_BILLING_TRIGGER_TASKER_MODULE: Symbol(+ "PlatformOrganizationBillingTriggerTaskerModule"+ ),PLATFORM_ORGANIZATION_BILLING_TASKER: Symbol("PlatformOrganizationBillingTasker"),PLATFORM_ORGANIZATION_BILLING_TASKER_MODULE: Symbol("PlatformOrganizationBillingTaskerModule"),};diff --git a/packages/features/ee/organizations/di/tokens.ts b/packages/features/ee/organizations/di/tokens.tsindex c6b23698ee6..23fb5e7ffa8 100644--- a/packages/features/ee/organizations/di/tokens.ts+++ b/packages/features/ee/organizations/di/tokens.ts@@ -1,6 +1,6 @@export const ORGANIZATION_DI_TOKENS = {- ORGANIZATION_REPOSITORY: Symbol("OrganizationRepository"),- ORGANIZATION_REPOSITORY_MODULE: Symbol("OrganizationRepositoryModule"),- ORGANIZATION_MEMBERSHIP_SERVICE: Symbol("OrganizationMembershipService"),- ORGANIZATION_MEMBERSHIP_SERVICE_MODULE: Symbol("OrganizationMembershipServiceModule"),+ ORGANIZATION_REPOSITORY: Symbol("OrganizationRepository"),+ ORGANIZATION_REPOSITORY_MODULE: Symbol("OrganizationRepositoryModule"),+ ORGANIZATION_MEMBERSHIP_SERVICE: Symbol("OrganizationMembershipService"),+ ORGANIZATION_MEMBERSHIP_SERVICE_MODULE: Symbol("OrganizationMembershipServiceModule"),};diff --git a/packages/features/ee/organizations/lib/server/orgCreationUtils.ts b/packages/features/ee/organizations/lib/server/orgCreationUtils.tsindex fdc1f033b1d..5915c6667d4 100644--- a/packages/features/ee/organizations/lib/server/orgCreationUtils.ts+++ b/packages/features/ee/organizations/lib/server/orgCreationUtils.ts@@ -205,9 +205,8 @@ export async function assertCanCreateOrg({errorOnUserAlreadyPartOfOrg?: boolean;}) {const featuresRepository = new FeaturesRepository(prisma);- const emailVerificationEnabled = await featuresRepository.checkIfFeatureIsEnabledGlobally(- "email-verification"- );+ const emailVerificationEnabled =+ await featuresRepository.checkIfFeatureIsEnabledGlobally("email-verification");const verifiedUser = emailVerificationEnabled ? !!orgOwner.emailVerified : true;if (!verifiedUser) {diff --git a/packages/features/ee/organizations/lib/service/OrganizationMembershipService.ts b/packages/features/ee/organizations/lib/service/OrganizationMembershipService.tsindex 2a25883655e..fe4941a7c5b 100644--- a/packages/features/ee/organizations/lib/service/OrganizationMembershipService.ts+++ b/packages/features/ee/organizations/lib/service/OrganizationMembershipService.ts@@ -1,37 +1,36 @@import type { IOrganizationRepository } from "../repository/IOrganizationRepository";export interface IOrganizationMembershipServiceDependencies {- organizationRepository: IOrganizationRepository;+ organizationRepository: IOrganizationRepository;}export class OrganizationMembershipService {- constructor(private readonly deps: IOrganizationMembershipServiceDependencies) { }+ constructor(private readonly deps: IOrganizationMembershipServiceDependencies) {}- /**- * Determines if user should be auto-accepted to an organization or its sub-teams based on email domain- */- async shouldAutoAccept({- organizationId,- userEmail,- }: {- organizationId: number;- userEmail: string;- }): Promise<boolean> {- const orgSettings = await this.deps.organizationRepository.getOrganizationAutoAcceptSettings(- organizationId- );+ /**+ * Determines if user should be auto-accepted to an organization or its sub-teams based on email domain+ */+ async shouldAutoAccept({+ organizationId,+ userEmail,+ }: {+ organizationId: number;+ userEmail: string;+ }): Promise<boolean> {+ const orgSettings =+ await this.deps.organizationRepository.getOrganizationAutoAcceptSettings(organizationId);- if (!orgSettings) return false;+ if (!orgSettings) return false;- const { orgAutoAcceptEmail, isOrganizationVerified } = orgSettings;+ const { orgAutoAcceptEmail, isOrganizationVerified } = orgSettings;- if (!isOrganizationVerified || !orgAutoAcceptEmail) return false;+ if (!isOrganizationVerified || !orgAutoAcceptEmail) return false;- // Case-insensitive comparison (email domains are case-insensitive per RFC)- const emailDomain = userEmail.split("@")[1]?.trim().toLowerCase();- const autoAcceptEmailDomain = orgAutoAcceptEmail.trim().toLowerCase();+ // Case-insensitive comparison (email domains are case-insensitive per RFC)+ const emailDomain = userEmail.split("@")[1]?.trim().toLowerCase();+ const autoAcceptEmailDomain = orgAutoAcceptEmail.trim().toLowerCase();- if (!emailDomain) return false;+ if (!emailDomain) return false;- return emailDomain === autoAcceptEmailDomain;- }+ return emailDomain === autoAcceptEmailDomain;+ }}diff --git a/packages/features/ee/organizations/lib/service/onboarding/__tests__/BaseOnboardingService.test.ts b/packages/features/ee/organizations/lib/service/onboarding/__tests__/BaseOnboardingService.test.tsindex 6823792acf7..e0b0aa6c5da 100644--- a/packages/features/ee/organizations/lib/service/onboarding/__tests__/BaseOnboardingService.test.ts+++ b/packages/features/ee/organizations/lib/service/onboarding/__tests__/BaseOnboardingService.test.ts@@ -184,7 +184,11 @@ describe("BaseOnboardingService", () => {it("should handle undefined teams and invites", async () => {const service = new TestableBaseOnboardingService(mockUser);- const { teamsData, invitedMembersData } = await service.testBuildTeamsAndInvites("test-org", undefined, undefined);+ const { teamsData, invitedMembersData } = await service.testBuildTeamsAndInvites(+ "test-org",+ undefined,+ undefined+ );expect(teamsData).toEqual([]);expect(invitedMembersData).toEqual([]);@@ -203,7 +207,11 @@ describe("BaseOnboardingService", () => {{ email: "[email protected]", teamId: -1, teamName: "Sales", role: "ADMIN" },];- const { teamsData, invitedMembersData } = await service.testBuildTeamsAndInvites("test-org", teams, invites);+ const { teamsData, invitedMembersData } = await service.testBuildTeamsAndInvites(+ "test-org",+ teams,+ invites+ );expect(teamsData).toHaveLength(2);expect(invitedMembersData).toHaveLength(2);@@ -227,7 +235,11 @@ describe("BaseOnboardingService", () => {{ email: "[email protected]", teamName: "Engineering", teamId: 42, role: "ADMIN" },];- const { teamsData, invitedMembersData } = await service.testBuildTeamsAndInvites("test-org", teams, invites);+ const { teamsData, invitedMembersData } = await service.testBuildTeamsAndInvites(+ "test-org",+ teams,+ invites+ );expect(teamsData).toHaveLength(2);expect(invitedMembersData).toHaveLength(3);diff --git a/packages/features/ee/organizations/lib/utils.ts b/packages/features/ee/organizations/lib/utils.tsindex d7ecd3ff34b..eeba8d3f096 100644--- a/packages/features/ee/organizations/lib/utils.ts+++ b/packages/features/ee/organizations/lib/utils.ts@@ -3,7 +3,9 @@ export function extractDomainFromEmail(email: string) {try {const match = email.match(/^(?:.*?:\/\/)?.*?([\w-]*(?:\.\w{2,}|\.\w{2,}\.\w{2}))(?:[/?#:]|$)/);out = (match && match[1]) ?? "";- } catch { /* empty */ }+ } catch {+ /* empty */+ }return out.split(".")[0];}diff --git a/packages/features/ee/payments/api/webhook.ts b/packages/features/ee/payments/api/webhook.tsindex 8f950765722..2c3979b53c6 100644--- a/packages/features/ee/payments/api/webhook.ts+++ b/packages/features/ee/payments/api/webhook.ts@@ -8,13 +8,8 @@ import {eventTypeMetaDataSchemaWithTypedApps,eventTypeAppMetadataOptionalSchema,} from "@calcom/app-store/zod-utils";-import {- sendAttendeeRequestEmailAndSMS,- sendOrganizerRequestEmail,-} from "@calcom/emails/email-manager";-import EventManager, {- placeholderCreatedEvent,-} from "@calcom/features/bookings/lib/EventManager";+import { sendAttendeeRequestEmailAndSMS, sendOrganizerRequestEmail } from "@calcom/emails/email-manager";+import EventManager, { placeholderCreatedEvent } from "@calcom/features/bookings/lib/EventManager";import { doesBookingRequireConfirmation } from "@calcom/features/bookings/lib/doesBookingRequireConfirmation";import { getAllCredentialsIncludeServiceAccountKey } from "@calcom/features/bookings/lib/getAllCredentialsForUsersOnEvent/getAllCredentials";import { handleConfirmation } from "@calcom/features/bookings/lib/handleConfirmation";@@ -41,10 +36,7 @@ export const config = {},};-export async function handleStripePaymentSuccess(- event: Stripe.Event,- traceContext: TraceContext-) {+export async function handleStripePaymentSuccess(event: Stripe.Event, traceContext: TraceContext) {const paymentIntent = event.data.object as Stripe.PaymentIntent;const payment = await prisma.payment.findFirst({where: {@@ -57,15 +49,10 @@ export async function handleStripePaymentSuccess(});if (!payment?.bookingId) {- log.error(- "Stripe: Payment Not Found",- safeStringify(paymentIntent),- safeStringify(payment)- );+ log.error("Stripe: Payment Not Found", safeStringify(paymentIntent), safeStringify(payment));throw new HttpCode({ statusCode: 204, message: "Payment not found" });}- if (!payment?.bookingId)- throw new HttpCode({ statusCode: 204, message: "Payment not found" });+ if (!payment?.bookingId) throw new HttpCode({ statusCode: 204, message: "Payment not found" });await handlePaymentSuccess({paymentId: payment.id,@@ -75,10 +62,7 @@ export async function handleStripePaymentSuccess(});}-const handleSetupSuccess = async (- event: Stripe.Event,- traceContext: TraceContext-) => {+const handleSetupSuccess = async (event: Stripe.Event, traceContext: TraceContext) => {const setupIntent = event.data.object as Stripe.SetupIntent;const payment = await prisma.payment.findFirst({where: {@@ -86,8 +70,7 @@ const handleSetupSuccess = async (},});- if (!payment?.data || !payment?.id)- throw new HttpCode({ statusCode: 204, message: "Payment not found" });+ if (!payment?.data || !payment?.id) throw new HttpCode({ statusCode: 204, message: "Payment not found" });const { booking, user, evt, eventType } = await getBooking(payment.bookingId);@@ -108,9 +91,7 @@ const handleSetupSuccess = async (},});- const metadata = eventTypeMetaDataSchemaWithTypedApps.parse(- eventType?.metadata- );+ const metadata = eventTypeMetaDataSchemaWithTypedApps.parse(eventType?.metadata);const allCredentials = await getAllCredentialsIncludeServiceAccountKey(user, {...booking.eventType,metadata,@@ -120,15 +101,11 @@ const handleSetupSuccess = async (const platformOAuthClient = user.isPlatformManaged? await platformOAuthClientRepository.getByUserId(user.id): null;- const areCalendarEventsEnabled =- platformOAuthClient?.areCalendarEventsEnabled ?? true;+ const areCalendarEventsEnabled = platformOAuthClient?.areCalendarEventsEnabled ?? true;const areEmailsEnabled = platformOAuthClient?.areEmailsEnabled ?? true;if (!requiresConfirmation) {- const eventManager = new EventManager(- { ...user, credentials: allCredentials },- metadata?.apps- );+ const eventManager = new EventManager({ ...user, credentials: allCredentials }, metadata?.apps);const scheduleResult = areCalendarEventsEnabled? await eventManager.create(evt): placeholderCreatedEvent;@@ -165,27 +142,18 @@ const handleSetupSuccess = async (bookingId: booking.id,booking,paid: true,- platformClientParams: platformOAuthClient- ? getPlatformParams(platformOAuthClient)- : undefined,+ platformClientParams: platformOAuthClient ? getPlatformParams(platformOAuthClient) : undefined,traceContext: updatedTraceContext,actionSource: "WEBHOOK",actor,});} else if (areEmailsEnabled) {await sendOrganizerRequestEmail({ ...evt }, eventType.metadata);- await sendAttendeeRequestEmailAndSMS(- { ...evt },- evt.attendees[0],- eventType.metadata- );+ await sendAttendeeRequestEmailAndSMS({ ...evt }, evt.attendees[0], eventType.metadata);}};-type WebhookHandler = (- event: Stripe.Event,- traceContext: TraceContext-) => Promise<void>;+type WebhookHandler = (event: Stripe.Event, traceContext: TraceContext) => Promise<void>;const webhookHandlers: Record<string, WebhookHandler | undefined> = {"payment_intent.succeeded": handleStripePaymentSuccess,@@ -197,10 +165,7 @@ const webhookHandlers: Record<string, WebhookHandler | undefined> = {* We need to create a PaymentManager in `@calcom/lib`* to prevent circular dependencies on App Store migration*/-export default async function handler(- req: NextApiRequest,- res: NextApiResponse-) {+export default async function handler(req: NextApiRequest, res: NextApiResponse) {try {if (req.method !== "POST") {throw new HttpCode({ statusCode: 405, message: "Method Not Allowed" });@@ -233,11 +198,7 @@ export default async function handler(let event: Stripe.Event;try {- event = stripe.webhooks.constructEvent(- payload,- sig,- process.env.STRIPE_WEBHOOK_SECRET- );+ event = stripe.webhooks.constructEvent(payload, sig, process.env.STRIPE_WEBHOOK_SECRET);} catch (err) {log.error("Stripe webhook signature verification failed", {stripeEventId,diff --git a/packages/features/ee/round-robin/handleRescheduleEventManager.ts b/packages/features/ee/round-robin/handleRescheduleEventManager.tsindex eb9a6f71d0b..071a3135fe5 100644--- a/packages/features/ee/round-robin/handleRescheduleEventManager.ts+++ b/packages/features/ee/round-robin/handleRescheduleEventManager.ts@@ -124,7 +124,7 @@ export const handleRescheduleEventManager = async ({const googleHangoutLink = Array.isArray(googleCalResult?.updatedEvent)? googleCalResult.updatedEvent[0]?.hangoutLink- : googleCalResult?.updatedEvent?.hangoutLink ?? googleCalResult?.createdEvent?.hangoutLink;+ : (googleCalResult?.updatedEvent?.hangoutLink ?? googleCalResult?.createdEvent?.hangoutLink);if (googleHangoutLink) {results.push({@@ -154,7 +154,7 @@ export const handleRescheduleEventManager = async ({}const createdOrUpdatedEvent = Array.isArray(results[0]?.updatedEvent)? results[0]?.updatedEvent[0]- : results[0]?.updatedEvent ?? results[0]?.createdEvent;+ : (results[0]?.updatedEvent ?? results[0]?.createdEvent);metadata.hangoutLink = createdOrUpdatedEvent?.hangoutLink;metadata.conferenceData = createdOrUpdatedEvent?.conferenceData;metadata.entryPoints = createdOrUpdatedEvent?.entryPoints;diff --git a/packages/features/ee/round-robin/roundRobinManualReassignment.ts b/packages/features/ee/round-robin/roundRobinManualReassignment.tsindex 20dfe81586a..4f9965227b8 100644--- a/packages/features/ee/round-robin/roundRobinManualReassignment.ts+++ b/packages/features/ee/round-robin/roundRobinManualReassignment.ts@@ -268,9 +268,7 @@ export const roundRobinManualReassignment = async ({organizationId: orgId,source: actionSource,auditData: {- ...(hasOrganizerChanged- ? { organizerUuid: { old: originalOrganizer.uuid, new: newUser.uuid } }- : null),+ ...(hasOrganizerChanged ? { organizerUuid: { old: originalOrganizer.uuid, new: newUser.uuid } } : null),...(attendeeUpdatedId? {hostAttendeeUpdated: {diff --git a/packages/features/ee/teams/lib/getTeamMemberEmailFromCrm.ts b/packages/features/ee/teams/lib/getTeamMemberEmailFromCrm.tsindex 5f9b57b2c65..8b72c58b074 100644--- a/packages/features/ee/teams/lib/getTeamMemberEmailFromCrm.ts+++ b/packages/features/ee/teams/lib/getTeamMemberEmailFromCrm.ts@@ -79,8 +79,8 @@ async function getAttributeRoutingConfig(const routingFormResponseQuery = routingFormResponseId? await routingFormResponseRepository.findFormResponseIncludeForm({ routingFormResponseId }): queuedFormResponseId- ? await routingFormResponseRepository.findQueuedFormResponseIncludeForm({ queuedFormResponseId })- : null;+ ? await routingFormResponseRepository.findQueuedFormResponseIncludeForm({ queuedFormResponseId })+ : null;if (!routingFormResponseQuery || !routingFormResponseQuery?.form.routes) return null;const parsedRoutes = routesSchema.safeParse(routingFormResponseQuery?.form.routes);@@ -232,8 +232,8 @@ async function getTeamMemberEmailForResponseOrContact({routingFormResponseId || queuedFormResponseId? { routingFormResponseId, queuedFormResponseId, eventTypeId }: chosenRoute- ? { route: chosenRoute }- : null;+ ? { route: chosenRoute }+ : null;// If we have found crmAppSlug, it means that the CRM App in the routing-form will handle the logicif (attributeRoutingConfigGetterData && crmAppSlug) {diff --git a/packages/features/ee/teams/lib/payments.ts b/packages/features/ee/teams/lib/payments.tsindex d8f78ad9acd..4d59578eccf 100644--- a/packages/features/ee/teams/lib/payments.ts+++ b/packages/features/ee/teams/lib/payments.ts@@ -68,15 +68,15 @@ export const generateTeamCheckoutSession = async ({mode: "subscription",...(dubCustomer?.discount?.couponId? {- discounts: [- {- coupon:- process.env.NODE_ENV !== "production" && dubCustomer.discount.couponTestId- ? dubCustomer.discount.couponTestId- : dubCustomer.discount.couponId,- },- ],- }+ discounts: [+ {+ coupon:+ process.env.NODE_ENV !== "production" && dubCustomer.discount.couponTestId+ ? dubCustomer.discount.couponTestId+ : dubCustomer.discount.couponId,+ },+ ],+ }: { allow_promotion_codes: true }),success_url: `${WEBAPP_URL}/api/teams/create?session_id={CHECKOUT_SESSION_ID}`,cancel_url: `${WEBAPP_URL}/settings/my-account/profile`,@@ -108,8 +108,14 @@ export const generateTeamCheckoutSession = async ({userId,dubCustomerId: userId, // pass the userId during checkout creation for sales conversion tracking: https://d.to/conversions/stripe...(isOnboarding !== undefined && { isOnboarding: isOnboarding.toString() }),- ...(tracking?.googleAds?.gclid && { gclid: tracking.googleAds.gclid, campaignId: tracking.googleAds?.campaignId }),- ...(tracking?.linkedInAds?.liFatId && { liFatId: tracking.linkedInAds.liFatId, linkedInCampaignId: tracking.linkedInAds?.campaignId }),+ ...(tracking?.googleAds?.gclid && {+ gclid: tracking.googleAds.gclid,+ campaignId: tracking.googleAds?.campaignId,+ }),+ ...(tracking?.linkedInAds?.liFatId && {+ liFatId: tracking.linkedInAds.liFatId,+ linkedInCampaignId: tracking.linkedInAds?.campaignId,+ }),},});return session;@@ -160,10 +166,7 @@ export const purchaseTeamOrOrgSubscription = async (input: {let priceId: string | undefined;if (pricePerSeat) {- if (- isOrg &&- pricePerSeat === ORGANIZATION_SELF_SERVE_PRICE- ) {+ if (isOrg && pricePerSeat === ORGANIZATION_SELF_SERVE_PRICE) {priceId = fixedPrice as string;} else {const customPriceObj = await getPriceObject(fixedPrice);@@ -201,8 +204,14 @@ export const purchaseTeamOrOrgSubscription = async (input: {},metadata: {teamId,- ...(tracking?.googleAds?.gclid && { gclid: tracking.googleAds.gclid, campaignId: tracking.googleAds.campaignId }),- ...(tracking?.linkedInAds?.liFatId && { liFatId: tracking.linkedInAds.liFatId, linkedInCampaignId: tracking.linkedInAds?.campaignId }),+ ...(tracking?.googleAds?.gclid && {+ gclid: tracking.googleAds.gclid,+ campaignId: tracking.googleAds.campaignId,+ }),+ ...(tracking?.linkedInAds?.liFatId && {+ liFatId: tracking.linkedInAds.liFatId,+ linkedInCampaignId: tracking.linkedInAds?.campaignId,+ }),},subscription_data: {metadata: {diff --git a/packages/features/ee/teams/repositories/TeamRepository.ts b/packages/features/ee/teams/repositories/TeamRepository.tsindex 830bdf18398..e3ed188a8cc 100644--- a/packages/features/ee/teams/repositories/TeamRepository.ts+++ b/packages/features/ee/teams/repositories/TeamRepository.ts@@ -10,10 +10,7 @@ import { MembershipRole } from "@calcom/prisma/enums";import { teamMetadataSchema } from "@calcom/prisma/zod-utils";type TeamGetPayloadWithParsedMetadata<TeamSelect extends Prisma.TeamSelect> =- | (Omit<- Prisma.TeamGetPayload<{ select: TeamSelect }>,- "metadata" | "isOrganization"- > & {+ | (Omit<Prisma.TeamGetPayload<{ select: TeamSelect }>, "metadata" | "isOrganization"> & {metadata: z.infer<typeof teamMetadataSchema>;isOrganization: boolean;})@@ -51,17 +48,14 @@ async function getTeamOrOrg<TeamSelect extends Prisma.TeamSelect>({forOrgWithSlug: forOrgWithSlug,isOrg,teamSelect,-}: GetTeamOrOrgArg<TeamSelect>): Promise<- TeamGetPayloadWithParsedMetadata<TeamSelect>-> {+}: GetTeamOrOrgArg<TeamSelect>): Promise<TeamGetPayloadWithParsedMetadata<TeamSelect>> {const where: Prisma.TeamFindFirstArgs["where"] = {};teamSelect = {...teamSelect,metadata: true,isOrganization: true,} satisfies TeamSelect;- if (lookupBy.havingMemberWithId)- where.members = { some: { userId: lookupBy.havingMemberWithId } };+ if (lookupBy.havingMemberWithId) where.members = { some: { userId: lookupBy.havingMemberWithId } };if ("id" in lookupBy) {where.id = lookupBy.id;@@ -114,20 +108,17 @@ async function getTeamOrOrg<TeamSelect extends Prisma.TeamSelect>({});if (teamsWithParsedMetadata.length > 1) {- log.error(- "Found more than one team/Org. We should be doing something wrong.",- {- isOrgView: isOrg,- where,- teams: teamsWithParsedMetadata.map((team) => {- const t = team as unknown as { id: number; slug: string };- return {- id: t.id,- slug: t.slug,- };- }),- }- );+ log.error("Found more than one team/Org. We should be doing something wrong.", {+ isOrgView: isOrg,+ where,+ teams: teamsWithParsedMetadata.map((team) => {+ const t = team as unknown as { id: number; slug: string };+ return {+ id: t.id,+ slug: t.slug,+ };+ }),+ });}const team = teamsWithParsedMetadata[0];@@ -141,9 +132,7 @@ export async function getTeam<TeamSelect extends Prisma.TeamSelect>({lookupBy,forOrgWithSlug: forOrgWithSlug,teamSelect,-}: Omit<GetTeamOrOrgArg<TeamSelect>, "isOrg">): Promise<- TeamGetPayloadWithParsedMetadata<TeamSelect>-> {+}: Omit<GetTeamOrOrgArg<TeamSelect>, "isOrg">): Promise<TeamGetPayloadWithParsedMetadata<TeamSelect>> {return getTeamOrOrg({lookupBy,forOrgWithSlug: forOrgWithSlug,@@ -156,9 +145,7 @@ export async function getOrg<TeamSelect extends Prisma.TeamSelect>({lookupBy,forOrgWithSlug: forOrgWithSlug,teamSelect,-}: Omit<GetTeamOrOrgArg<TeamSelect>, "isOrg">): Promise<- TeamGetPayloadWithParsedMetadata<TeamSelect>-> {+}: Omit<GetTeamOrOrgArg<TeamSelect>, "isOrg">): Promise<TeamGetPayloadWithParsedMetadata<TeamSelect>> {return getTeamOrOrg({lookupBy,forOrgWithSlug: forOrgWithSlug,@@ -254,9 +241,7 @@ export class TeamRepository {return await this.prismaClient.team.findFirst({where: {slug,- parent: parentSlug- ? whereClauseForOrgWithSlugOrRequestedSlug(parentSlug)- : null,+ parent: parentSlug ? whereClauseForOrgWithSlugOrRequestedSlug(parentSlug) : null,},select,});@@ -307,13 +292,7 @@ export class TeamRepository {});}- async findTeamsByUserId({- userId,- includeOrgs,- }: {- userId: number;- includeOrgs?: boolean;- }) {+ async findTeamsByUserId({ userId, includeOrgs }: { userId: number; includeOrgs?: boolean }) {const memberships = await this.prismaClient.membership.findMany({where: {// Show all the teams this user belongs to regardless of the team being part of the user's org or not@@ -356,10 +335,7 @@ export class TeamRepository {// Only return inviteToken if user is OWNER or ADMINconst inviteToken =membership.role === "OWNER" || membership.role === "ADMIN"- ? inviteTokens.find(- (token) =>- token.identifier === `invite-link-for-teamId-${team.id}`- )+ ? inviteTokens.find((token) => token.identifier === `invite-link-for-teamId-${team.id}`): null;return {@@ -396,9 +372,7 @@ export class TeamRepository {},});- return memberships- .filter((mmship) => !mmship.team.isOrganization)- .map((mmship) => mmship.team);+ return memberships.filter((mmship) => !mmship.team.isOrganization).map((mmship) => mmship.team);}async findTeamWithOrganizationSettings(teamId: number) {@@ -473,13 +447,7 @@ export class TeamRepository {});}- async findOrganization({- teamId,- userId,- }: {- teamId?: number;- userId: number;- }) {+ async findOrganization({ teamId, userId }: { teamId?: number; userId: number }) {return await this.prismaClient.team.findFirst({where: {isOrganization: true,@@ -501,11 +469,7 @@ export class TeamRepository {});}- async findOrganizationIdBySlug({- slug,- }: {- slug: string;- }): Promise<number | null> {+ async findOrganizationIdBySlug({ slug }: { slug: string }): Promise<number | null> {const org = await this.prismaClient.team.findFirst({where: {slug,@@ -545,13 +509,7 @@ export class TeamRepository {return !conflictingTeam;}- async getTeamByIdIfUserIsAdmin({- userId,- teamId,- }: {- userId: number;- teamId: number;- }) {+ async getTeamByIdIfUserIsAdmin({ userId, teamId }: { userId: number; teamId: number }) {return await this.prismaClient.team.findUnique({where: {id: teamId,@@ -571,13 +529,7 @@ export class TeamRepository {});}- async findOrgTeamsExcludingTeam({- parentId,- excludeTeamId,- }: {- parentId: number;- excludeTeamId: number;- }) {+ async findOrgTeamsExcludingTeam({ parentId, excludeTeamId }: { parentId: number; excludeTeamId: number }) {return await this.prismaClient.team.findMany({where: {parentId,@@ -660,13 +612,7 @@ export class TeamRepository {return { resource, action };}- async findTeamsNotBelongingToOrgByIds({- teamIds,- orgId,- }: {- teamIds: number[];- orgId: number;- }) {+ async findTeamsNotBelongingToOrgByIds({ teamIds, orgId }: { teamIds: number[]; orgId: number }) {return await this.prismaClient.team.findMany({where: {id: { in: teamIds },@@ -677,13 +623,7 @@ export class TeamRepository {});}- async findByIdsAndOrgId({- teamIds,- orgId,- }: {- teamIds: number[];- orgId: number;- }) {+ async findByIdsAndOrgId({ teamIds, orgId }: { teamIds: number[]; orgId: number }) {return await this.prismaClient.team.findMany({where: {id: { in: teamIds },diff --git a/packages/features/ee/teams/services/teamService.alternative.test.ts b/packages/features/ee/teams/services/teamService.alternative.test.tsindex ad619ffbcd4..c0f210b5b3c 100644--- a/packages/features/ee/teams/services/teamService.alternative.test.ts+++ b/packages/features/ee/teams/services/teamService.alternative.test.ts@@ -50,7 +50,9 @@ const mockTeamRepo = {throw new Error(`Team with id ${id} not found`);}),};-vi.mocked(TeamRepository).mockImplementation(function() { return mockTeamRepo; });+vi.mocked(TeamRepository).mockImplementation(function () {+ return mockTeamRepo;+});vi.mocked(deleteDomain).mockImplementation(async (slug) => {database.domains.delete(slug);@@ -63,7 +65,7 @@ vi.mocked(WorkflowService.deleteWorkflowRemindersOfRemovedTeam).mockImplementatidescribe("TeamService", () => {beforeEach(async () => {database.clear();-+const { getTeamBillingServiceFactory } = await import("@calcom/ee/billing/di/containers/Billing");vi.mocked(getTeamBillingServiceFactory).mockReturnValue({findAndInit: vi.fn().mockImplementation(async (teamId) => {diff --git a/packages/features/ee/teams/services/teamService.integration-test.ts b/packages/features/ee/teams/services/teamService.integration-test.tsindex 4e7df206129..9eab1ab0670 100644--- a/packages/features/ee/teams/services/teamService.integration-test.ts+++ b/packages/features/ee/teams/services/teamService.integration-test.ts@@ -34,7 +34,9 @@ const createTestUser = async (overrides?: {data: {email: overrides?.email ?? `test-user-${timestamp}-${randomSuffix}@example.com`,username:- overrides?.username === null ? null : overrides?.username ?? `testuser-${timestamp}-${randomSuffix}`,+ overrides?.username === null+ ? null+ : (overrides?.username ?? `testuser-${timestamp}-${randomSuffix}`),name: "Test User",organizationId: overrides?.organizationId ?? undefined,},diff --git a/packages/features/ee/tsconfig.json b/packages/features/ee/tsconfig.jsonindex 68f3705dfe4..ec89ff18af3 100644--- a/packages/features/ee/tsconfig.json+++ b/packages/features/ee/tsconfig.json@@ -15,5 +15,13 @@"../../types/business-days-plugin.d.ts","../../types/window.d.ts"],- "exclude": ["dist", "build", "**/node_modules/**", "**/*.test.*", "**/__mocks__/*", "**/__tests__/*", "billing"]+ "exclude": [+ "dist",+ "build",+ "**/node_modules/**",+ "**/*.test.*",+ "**/__mocks__/*",+ "**/__tests__/*",+ "billing"+ ]}diff --git a/packages/features/ee/workflows/api/scheduleEmailReminders.ts b/packages/features/ee/workflows/api/scheduleEmailReminders.tsindex b680b62a48d..c683667325a 100644--- a/packages/features/ee/workflows/api/scheduleEmailReminders.ts+++ b/packages/features/ee/workflows/api/scheduleEmailReminders.ts@@ -531,4 +531,4 @@ function shouldHideBranding(booking: {return !!booking.user?.hideBranding;}-export {handler};\ No newline at end of file+export { handler };diff --git a/packages/features/ee/workflows/hooks/useVoicePreview.ts b/packages/features/ee/workflows/hooks/useVoicePreview.tsindex 6cf66ddc612..aceb080d05b 100644--- a/packages/features/ee/workflows/hooks/useVoicePreview.ts+++ b/packages/features/ee/workflows/hooks/useVoicePreview.ts@@ -48,7 +48,8 @@ export function useVoicePreview() {setCurrentAudio(audio);audioRef.current = audio;- audio.play()+ audio+ .play().then(() => {setPlayingVoiceId(voiceId || null);})diff --git a/packages/features/ee/workflows/lib/getOptions.ts b/packages/features/ee/workflows/lib/getOptions.tsindex 22063ccf3ad..4c045577c48 100644--- a/packages/features/ee/workflows/lib/getOptions.ts+++ b/packages/features/ee/workflows/lib/getOptions.ts@@ -75,7 +75,12 @@ function convertToTemplateOptions(value: template,needsTeamsUpgrade,upgradeTeamsBadgeProps: needsTeamsUpgrade ? { hasPaidPlan, hasActiveTeamPlan, isTrial } : undefined,- } as { label: string; value: WorkflowTemplates; needsTeamsUpgrade: boolean; upgradeTeamsBadgeProps?: PlanState };+ } as {+ label: string;+ value: WorkflowTemplates;+ needsTeamsUpgrade: boolean;+ upgradeTeamsBadgeProps?: PlanState;+ };});}@@ -93,8 +98,8 @@ export function getWorkflowTemplateOptions(action && isWhatsappAction(action)? WHATSAPP_WORKFLOW_TEMPLATES: action && isEmailToAttendeeAction(action)- ? ATTENDEE_WORKFLOW_TEMPLATES- : BASIC_WORKFLOW_TEMPLATES;+ ? ATTENDEE_WORKFLOW_TEMPLATES+ : BASIC_WORKFLOW_TEMPLATES;return convertToTemplateOptions(t, planState, TEMPLATES);}diff --git a/packages/features/ee/workflows/lib/reminders/reminderScheduler.ts b/packages/features/ee/workflows/lib/reminders/reminderScheduler.tsindex eb6ed7c93ea..7cae2f734d3 100644--- a/packages/features/ee/workflows/lib/reminders/reminderScheduler.ts+++ b/packages/features/ee/workflows/lib/reminders/reminderScheduler.ts@@ -78,9 +78,8 @@ const getReminderPhoneNumber = async (if (seatReferenceUid) {const bookingSeatRepository = new BookingSeatRepository(prisma);- const seatAttendeeData = await bookingSeatRepository.getByReferenceUidWithAttendeeDetails(- seatReferenceUid- );+ const seatAttendeeData =+ await bookingSeatRepository.getByReferenceUidWithAttendeeDetails(seatReferenceUid);return seatAttendeeData?.attendee?.phoneNumber || smsReminderNumber;}diff --git a/packages/features/ee/workflows/lib/reminders/templates/customTemplate.ts b/packages/features/ee/workflows/lib/reminders/templates/customTemplate.tsindex 889489dfe95..0c5bf3768a2 100644--- a/packages/features/ee/workflows/lib/reminders/templates/customTemplate.ts+++ b/packages/features/ee/workflows/lib/reminders/templates/customTemplate.ts@@ -128,13 +128,13 @@ const customTemplate = (const attendeeFirstName = variables.attendeeFirstName? variables.attendeeFirstName- : attendeeNameWords?.[0] ?? "";+ : (attendeeNameWords?.[0] ?? "");const attendeeLastName = variables.attendeeLastName? variables.attendeeLastName: attendeeNameWordCount > 1- ? attendeeNameWords![attendeeNameWordCount - 1]- : "";+ ? attendeeNameWords![attendeeNameWordCount - 1]+ : "";let dynamicText = text.replaceAll("{EVENT_NAME}", variables.eventName || "")diff --git a/packages/features/ee/workflows/lib/service/EmailWorkflowService.ts b/packages/features/ee/workflows/lib/service/EmailWorkflowService.tsindex 93b92e3d209..c55b3dd8bcb 100644--- a/packages/features/ee/workflows/lib/service/EmailWorkflowService.ts+++ b/packages/features/ee/workflows/lib/service/EmailWorkflowService.ts@@ -21,7 +21,11 @@ import { bookingMetadataSchema } from "@calcom/prisma/zod-utils";import { CalendarEvent } from "@calcom/types/Calendar";import type { WorkflowReminderRepository } from "../../repositories/WorkflowReminderRepository";-import { isEmailAction, getTemplateBodyForAction, getTemplateSubjectForAction } from "../actionHelperFunctions";+import {+ isEmailAction,+ getTemplateBodyForAction,+ getTemplateSubjectForAction,+} from "../actionHelperFunctions";import { detectMatchedTemplate } from "../detectMatchedTemplate";import { getWorkflowRecipientEmail } from "../getWorkflowReminders";import type { VariablesType } from "../reminders/templates/customTemplate";@@ -414,7 +418,7 @@ export class EmailWorkflowService {if (matchedTemplate === WorkflowTemplates.REMINDER) {const t = await getTranslation(locale, "common");- const meetingUrl =+ const meetingUrl =getVideoCallUrlFromCalEvent({videoCallData: evt.videoCallData,uid: evt.uid,@@ -547,10 +551,9 @@ export class EmailWorkflowService {};const shouldIncludeCalendarEvent =- includeCalendarEvent &&- triggerEvent !== WorkflowTriggerEvents.BOOKING_REQUESTED;+ includeCalendarEvent && triggerEvent !== WorkflowTriggerEvents.BOOKING_REQUESTED;- const attachments = shouldIncludeCalendarEvent+ const attachments = shouldIncludeCalendarEvent? [{content:@@ -578,4 +581,4 @@ export class EmailWorkflowService {sender,};}-}\ No newline at end of file+}diff --git a/packages/features/ee/workflows/lib/service/WorkflowService.test.ts b/packages/features/ee/workflows/lib/service/WorkflowService.test.tsindex 89574df00bb..67b90536402 100644--- a/packages/features/ee/workflows/lib/service/WorkflowService.test.ts+++ b/packages/features/ee/workflows/lib/service/WorkflowService.test.ts@@ -20,9 +20,11 @@ vi.mock("@calcom/features/profile/lib/hideBranding", () => ({const mockWorkflowReminderCreate = vi.fn();vi.mock("@calcom/features/ee/workflows/repositories/WorkflowReminderRepository", () => ({- WorkflowReminderRepository: vi.fn().mockImplementation(function() { return {- create: mockWorkflowReminderCreate,- }; }),+ WorkflowReminderRepository: vi.fn().mockImplementation(function () {+ return {+ create: mockWorkflowReminderCreate,+ };+ }),}));vi.mock("@calcom/prisma", () => ({diff --git a/packages/features/ee/workflows/lib/service/workflowOptOutService.ts b/packages/features/ee/workflows/lib/service/workflowOptOutService.tsindex 59f2bdb6efc..c8c73f0a71c 100644--- a/packages/features/ee/workflows/lib/service/workflowOptOutService.ts+++ b/packages/features/ee/workflows/lib/service/workflowOptOutService.ts@@ -8,9 +8,8 @@ export class WorkflowOptOutService {static async optOutPhoneNumber(phoneNumber: string) {await WorkflowOptOutContactRepository.addPhoneNumber(phoneNumber);// Delete scheduled workflows- const scheduledReminders = await WorkflowReminderRepository.getFutureScheduledAttendeeSMSReminders(- phoneNumber- );+ const scheduledReminders =+ await WorkflowReminderRepository.getFutureScheduledAttendeeSMSReminders(phoneNumber);// Get twilio scheduled workflows remindersawait deleteMultipleScheduledSMS(diff --git a/packages/features/ee/workflows/lib/test/compareReminderBodyToTemplate.test.ts b/packages/features/ee/workflows/lib/test/compareReminderBodyToTemplate.test.tsindex 74ca692ff6e..a193e9406d7 100644--- a/packages/features/ee/workflows/lib/test/compareReminderBodyToTemplate.test.ts+++ b/packages/features/ee/workflows/lib/test/compareReminderBodyToTemplate.test.ts@@ -4,8 +4,6 @@ import { getTranslation } from "@calcom/lib/server/i18n";import { TimeFormat } from "@calcom/lib/timeFormat";import { WorkflowActions, WorkflowTemplates } from "@calcom/prisma/enums";--import { getTemplateBodyForAction } from "../actionHelperFunctions";import compareReminderBodyToTemplate from "../compareReminderBodyToTemplate";import plainTextReminderTemplates from "../reminders/templates/plainTextTemplates";diff --git a/packages/features/ee/workflows/lib/test/twilioWebhook.test.ts b/packages/features/ee/workflows/lib/test/twilioWebhook.test.tsindex 129add17b5f..2820761d466 100644--- a/packages/features/ee/workflows/lib/test/twilioWebhook.test.ts+++ b/packages/features/ee/workflows/lib/test/twilioWebhook.test.ts@@ -18,10 +18,12 @@ vi.mock("../reminders/providers/twilioProvider", () => ({const mockChargeCredits = vi.fn().mockResolvedValue({ teamId: 1 });vi.mock("@calcom/features/ee/billing/credit-service", () => ({- CreditService: vi.fn().mockImplementation(function() { return {- chargeCredits: mockChargeCredits,- calculateCreditsFromPrice: vi.fn().mockReturnValue(1),- }; }),+ CreditService: vi.fn().mockImplementation(function () {+ return {+ chargeCredits: mockChargeCredits,+ calculateCreditsFromPrice: vi.fn().mockReturnValue(1),+ };+ }),}));const mockFindFirst = vi.fn();diff --git a/packages/features/ee/workflows/lib/urlScanner.ts b/packages/features/ee/workflows/lib/urlScanner.tsindex 98208156b02..d0649806af3 100644--- a/packages/features/ee/workflows/lib/urlScanner.ts+++ b/packages/features/ee/workflows/lib/urlScanner.ts@@ -295,12 +295,15 @@ async function getScanResult(scanId: string): Promise<UrlScanResult | null> {}try {- const response = await fetch(`${CLOUDFLARE_API_BASE}/accounts/${accountId}/urlscanner/v2/result/${scanId}`, {- method: "GET",- headers: {- Authorization: `Bearer ${apiToken}`,- },- });+ const response = await fetch(+ `${CLOUDFLARE_API_BASE}/accounts/${accountId}/urlscanner/v2/result/${scanId}`,+ {+ method: "GET",+ headers: {+ Authorization: `Bearer ${apiToken}`,+ },+ }+ );// 404 means scan is still in progressif (response.status === 404) {diff --git a/packages/features/ee/workflows/lib/variableTranslations.ts b/packages/features/ee/workflows/lib/variableTranslations.tsindex 7e030bc36a4..7bdc0c740fe 100644--- a/packages/features/ee/workflows/lib/variableTranslations.ts+++ b/packages/features/ee/workflows/lib/variableTranslations.ts@@ -16,8 +16,8 @@ export function getTranslatedText(text: string, language: { locale: string; t: Tlet translatedVariable = DYNAMIC_TEXT_VARIABLES.includes(variable.toLowerCase())? language.t(variable.toLowerCase().concat("_variable")).replace(/ /g, "_").toLocaleUpperCase(): DYNAMIC_TEXT_VARIABLES.includes(variable.toLowerCase().concat("_name")) //for the old variables names (ORGANIZER_NAME, ATTENDEE_NAME)- ? language.t(variable.toLowerCase().concat("_name_variable")).replace(/ /g, "_").toLocaleUpperCase()- : variable;+ ? language.t(variable.toLowerCase().concat("_name_variable")).replace(/ /g, "_").toLocaleUpperCase()+ : variable;// this takes care of translating formatted variables (e.g. {EVENT_DATE_DD MM YYYY})const formattedVarToTranslate = FORMATTED_DYNAMIC_TEXT_VARIABLES.map((formattedVar) => {diff --git a/packages/features/ee/workflows/repositories/WorkflowRepository.test.ts b/packages/features/ee/workflows/repositories/WorkflowRepository.test.tsindex 05228bc5043..c3c527d1d0f 100644--- a/packages/features/ee/workflows/repositories/WorkflowRepository.test.ts+++ b/packages/features/ee/workflows/repositories/WorkflowRepository.test.ts@@ -1,4 +1,3 @@-import prismaMock from "@calcom/testing/lib/__mocks__/prismaMock";import { describe, it, expect } from "vitest";diff --git a/packages/features/eventtypes/components/BulkEditDefaultForEventsModal.tsx b/packages/features/eventtypes/components/BulkEditDefaultForEventsModal.tsxindex 05716e0aabc..33374037917 100644--- a/packages/features/eventtypes/components/BulkEditDefaultForEventsModal.tsx+++ b/packages/features/eventtypes/components/BulkEditDefaultForEventsModal.tsx@@ -73,7 +73,9 @@ export function BulkEditDefaultForEventsModal({</div>)}{eventTypes.map((eventType) => (- <div key={eventType.id} className="bg-cal-muted flex items-center space-x-2 rounded-md px-3 py-2.5">+ <div+ key={eventType.id}+ className="bg-cal-muted flex items-center space-x-2 rounded-md px-3 py-2.5"><CheckboxFielddescription={eventType.title}descriptionAsLabeldiff --git a/packages/features/eventtypes/components/CheckedTeamSelect.tsx b/packages/features/eventtypes/components/CheckedTeamSelect.tsxindex 5880e133bc7..7b27d319b5a 100644--- a/packages/features/eventtypes/components/CheckedTeamSelect.tsx+++ b/packages/features/eventtypes/components/CheckedTeamSelect.tsx@@ -15,7 +15,10 @@ import { Select } from "@calcom/ui/components/form";import { Icon } from "@calcom/ui/components/icon";import { Tooltip } from "@calcom/ui/components/tooltip";-import type { PriorityDialogCustomClassNames, WeightDialogCustomClassNames } from "@calcom/features/eventtypes/components/dialogs/HostEditDialogs";+import type {+ PriorityDialogCustomClassNames,+ WeightDialogCustomClassNames,+} from "@calcom/features/eventtypes/components/dialogs/HostEditDialogs";import { PriorityDialog, WeightDialog } from "@calcom/features/eventtypes/components/dialogs/HostEditDialogs";export type CheckedSelectOption = {diff --git a/packages/features/eventtypes/components/tabs/limits/EventLimitsTab.tsx b/packages/features/eventtypes/components/tabs/limits/EventLimitsTab.tsxindex b1298a1f16b..ce4cb677aed 100644--- a/packages/features/eventtypes/components/tabs/limits/EventLimitsTab.tsx+++ b/packages/features/eventtypes/components/tabs/limits/EventLimitsTab.tsx@@ -401,31 +401,40 @@ export const EventLimitsTab = ({ eventType, customClassNames }: EventLimitsTabPrconst { t, i18n } = useLocale();const formMethods = useFormContext<FormValues>();-const hasTeamLimits = () => {- const team = eventType.team as { bookingLimits?: IntervalLimit | null; includeManagedEventsInLimits?: boolean } | null | undefined;- const parentTeam = (eventType.parent as { team?: { bookingLimits?: IntervalLimit | null; includeManagedEventsInLimits?: boolean } } | null | undefined)?.team;+ const team = eventType.team as+ | { bookingLimits?: IntervalLimit | null; includeManagedEventsInLimits?: boolean }+ | null+ | undefined;+ const parentTeam = (+ eventType.parent as+ | { team?: { bookingLimits?: IntervalLimit | null; includeManagedEventsInLimits?: boolean } }+ | null+ | undefined+ )?.team;- const teamHasLimits =- !!team?.bookingLimits && Object.keys(team.bookingLimits).length > 0;+ const teamHasLimits = !!team?.bookingLimits && Object.keys(team.bookingLimits).length > 0;const parentTeamHasLimits =- !!parentTeam?.bookingLimits &&- Object.keys(parentTeam.bookingLimits).length > 0;+ !!parentTeam?.bookingLimits && Object.keys(parentTeam.bookingLimits).length > 0;- const includeManaged =- !!parentTeam?.includeManagedEventsInLimits ||- !!team?.includeManagedEventsInLimits;+ const includeManaged = !!parentTeam?.includeManagedEventsInLimits || !!team?.includeManagedEventsInLimits;if (teamHasLimits) {- if(eventType.schedulingType === SchedulingType.MANAGED) return includeManaged;+ if (eventType.schedulingType === SchedulingType.MANAGED) return includeManaged;return true;}return parentTeamHasLimits && includeManaged;};- const TeamLimitsBadge = ({ isManagedChild, teamId }: { isManagedChild: boolean, teamId?: number | null }) => {+ const TeamLimitsBadge = ({+ isManagedChild,+ teamId,+ }: {+ isManagedChild: boolean;+ teamId?: number | null;+ }) => {const badge = (<Badge variant="blue" className="text-xs cursor-pointer hover:opacity-80">{t("team_limits_apply")}@@ -438,11 +447,7 @@ export const EventLimitsTab = ({ eventType, customClassNames }: EventLimitsTabPrif (teamId) {return (- <Link- href={`/settings/teams/${teamId}/settings`}- target="_blank"- rel="noopener noreferrer"- >+ <Link href={`/settings/teams/${teamId}/settings`} target="_blank" rel="noopener noreferrer">{badge}</Link>);@@ -654,7 +659,8 @@ export const EventLimitsTab = ({ eventType, customClassNames }: EventLimitsTabPrtitle={t("limit_booking_frequency")}Badge={hasTeamLimits()- ? TeamLimitsBadge({ isManagedChild: !!eventType.parent, teamId: eventType.team?.id }) : null+ ? TeamLimitsBadge({ isManagedChild: !!eventType.parent, teamId: eventType.team?.id })+ : null}{...bookingLimitsLocked}description={diff --git a/packages/features/eventtypes/components/tabs/recurring/RecurringEventController.tsx b/packages/features/eventtypes/components/tabs/recurring/RecurringEventController.tsxindex 8f697463d8c..60589a3f012 100644--- a/packages/features/eventtypes/components/tabs/recurring/RecurringEventController.tsx+++ b/packages/features/eventtypes/components/tabs/recurring/RecurringEventController.tsx@@ -106,8 +106,8 @@ export default function RecurringEventController({isSeatsOffered? t("seats_doesnt_support_recurring"): hasBookingLimitPerBooker- ? t("booking_limit_per_booker_doesnt_support_recurring")- : undefined+ ? t("booking_limit_per_booker_doesnt_support_recurring")+ : undefined}onCheckedChange={(e) => {if (!e) {diff --git a/packages/features/eventtypes/lib/getEventTypeById.integration-test.ts b/packages/features/eventtypes/lib/getEventTypeById.integration-test.tsindex 337f7158a1e..03c3e3f6146 100644--- a/packages/features/eventtypes/lib/getEventTypeById.integration-test.ts+++ b/packages/features/eventtypes/lib/getEventTypeById.integration-test.ts@@ -1,4 +1,4 @@-import { prisma } from "@calcom/prisma"+import { prisma } from "@calcom/prisma";import type { PrismaClient } from "@calcom/prisma";import i18nMock from "@calcom/testing/lib/__mocks__/libServerI18n";@@ -52,14 +52,14 @@ describe("getRawEventType", () => {organizationId: overrides?.organizationId,...(overrides?.withProfile &&overrides.organizationId && {- profiles: {- create: {- organizationId: overrides.organizationId,- uid: username,- username,+ profiles: {+ create: {+ organizationId: overrides.organizationId,+ uid: username,+ username,+ },},- },- }),+ }),},});createdResources.users.push(user.id);@@ -119,10 +119,7 @@ describe("getRawEventType", () => {return membership;};- const createTestEventType = async (- userId: number,- overrides?: { slug?: string; title?: string }- ) => {+ const createTestEventType = async (userId: number, overrides?: { slug?: string; title?: string }) => {const timestamp = Date.now() + Math.random();const eventType = await prisma.eventType.create({data: {diff --git a/packages/features/eventtypes/lib/getPublicEvent.ts b/packages/features/eventtypes/lib/getPublicEvent.tsindex 9fe8a0d3864..4f36bc6ebe2 100644--- a/packages/features/eventtypes/lib/getPublicEvent.ts+++ b/packages/features/eventtypes/lib/getPublicEvent.ts@@ -129,10 +129,10 @@ export const getPublicEventSelect = (fetchAllUsers: boolean) => {},},},- successRedirectUrl: true,- forwardParamsSuccessRedirect: true,- redirectUrlOnNoRoutingFormResponse: true,- workflows: {+ successRedirectUrl: true,+ forwardParamsSuccessRedirect: true,+ redirectUrlOnNoRoutingFormResponse: true,+ workflows: {include: {workflow: {include: {@@ -661,7 +661,7 @@ export async function getUsersFromEvent(// getOwnerFromUsersArray is used here for backward compatibility when team event type has users[] but not hosts[]return eventHosts.length? eventHosts.filter((host) => host.user.username).map(mapHostsToUsers)- : (await getOwnerFromUsersArray(prisma, id)) ?? [];+ : ((await getOwnerFromUsersArray(prisma, id)) ?? []);}if (!owner) {return null;diff --git a/packages/features/flags/features.repository.mock.ts b/packages/features/flags/features.repository.mock.tsindex 4db074a4ab8..418f8cfc874 100644--- a/packages/features/flags/features.repository.mock.ts+++ b/packages/features/flags/features.repository.mock.ts@@ -6,13 +6,8 @@ export class MockFeaturesRepository implements IFeaturesRepository {return slug === "mock-feature";}- async getUserFeaturesStatus(- _userId: number,- slugs: string[]- ): Promise<Record<string, boolean>> {- return Object.fromEntries(- slugs.map((slug) => [slug, slug === "mock-feature"])- );+ async getUserFeaturesStatus(_userId: number, slugs: string[]): Promise<Record<string, boolean>> {+ return Object.fromEntries(slugs.map((slug) => [slug, slug === "mock-feature"]));}async checkIfUserHasFeatureNonHierarchical(_userId: number, slug: string) {@@ -82,9 +77,7 @@ export class MockFeaturesRepository implements IFeaturesRepository {return false;}- async getTeamsAutoOptIn(- _teamIds: number[]- ): Promise<Record<number, boolean>> {+ async getTeamsAutoOptIn(_teamIds: number[]): Promise<Record<number, boolean>> {// Mock implementation - return empty (all teams default to false)return {};}diff --git a/packages/features/flags/features.repository.ts b/packages/features/flags/features.repository.tsindex 651b979a243..9a8c8a3cf41 100644--- a/packages/features/flags/features.repository.ts+++ b/packages/features/flags/features.repository.ts@@ -21,7 +21,7 @@ export class FeaturesRepository implements IFeaturesRepository {// eslint-disable-next-line @typescript-eslint/no-explicit-anyprivate static featuresCache: { data: any[]; expiry: number } | null = null;- constructor(private prismaClient: PrismaClient) { }+ constructor(private prismaClient: PrismaClient) {}private clearCache() {FeaturesRepository.featuresCache = null;diff --git a/packages/features/form-builder/utils/variantsConfig.ts b/packages/features/form-builder/utils/variantsConfig.tsindex 0e0b9db2339..26d623baecb 100644--- a/packages/features/form-builder/utils/variantsConfig.ts+++ b/packages/features/form-builder/utils/variantsConfig.ts@@ -16,28 +16,31 @@ function getTranslatedConfigVariants() {const fieldTypeVariantsConfig = fieldTypesConfigMap[fieldType]?.variantsConfig?.variants;- return Object.entries(configVariants).reduce((variantsConfigVariants, [variantName, variant]) => {- const variantFieldsMap = fieldTypeVariantsConfig?.[variantName as keyof typeof fieldTypeVariantsConfig]- ?.fieldsMap;+ return Object.entries(configVariants).reduce(+ (variantsConfigVariants, [variantName, variant]) => {+ const variantFieldsMap =+ fieldTypeVariantsConfig?.[variantName as keyof typeof fieldTypeVariantsConfig]?.fieldsMap;- const translatedFields = variant.fields.map((field) => {- const defaultLabel =- variantFieldsMap?.[field.name as keyof typeof variantFieldsMap]?.defaultLabel ?? "";- const label = (field.label?.trim() ? field.label : defaultLabel) ?? "";- const placeholder = field.placeholder ?? "";- return {- ...field,- label: translate(label),- placeholder: translate(placeholder),+ const translatedFields = variant.fields.map((field) => {+ const defaultLabel =+ variantFieldsMap?.[field.name as keyof typeof variantFieldsMap]?.defaultLabel ?? "";+ const label = (field.label?.trim() ? field.label : defaultLabel) ?? "";+ const placeholder = field.placeholder ?? "";+ return {+ ...field,+ label: translate(label),+ placeholder: translate(placeholder),+ };+ });+ variantsConfigVariants[variantName] = {+ ...variant,+ fields: translatedFields,};- });- variantsConfigVariants[variantName] = {- ...variant,- fields: translatedFields,- };- return variantsConfigVariants;- }, {} as typeof configVariants);+ return variantsConfigVariants;+ },+ {} as typeof configVariants+ );}/**diff --git a/packages/features/form/components/Select.tsx b/packages/features/form/components/Select.tsxindex 8702cc4a59e..17c74f8c993 100644--- a/packages/features/form/components/Select.tsx+++ b/packages/features/form/components/Select.tsx@@ -8,7 +8,7 @@ import classNames from "@calcom/ui/classNames";export type SelectProps<Option,IsMulti extends boolean = false,- Group extends GroupBase<Option> = GroupBase<Option>+ Group extends GroupBase<Option> = GroupBase<Option>,> = Props<Option, IsMulti, Group>;export const InputComponent = <Option, IsMulti extends boolean, Group extends GroupBase<Option>>({@@ -27,7 +27,7 @@ export const InputComponent = <Option, IsMulti extends boolean, Group extends Grfunction Select<Option,IsMulti extends boolean = false,- Group extends GroupBase<Option> = GroupBase<Option>+ Group extends GroupBase<Option> = GroupBase<Option>,>({ className, ...props }: SelectProps<Option, IsMulti, Group>) {const [mounted, setMounted] = useState<boolean>(false);const { resolvedTheme, forcedTheme } = useGetTheme();@@ -125,7 +125,7 @@ function Select<export function SelectWithValidation<Option extends { label: string; value: string },isMulti extends boolean = false,- Group extends GroupBase<Option> = GroupBase<Option>+ Group extends GroupBase<Option> = GroupBase<Option>,>({required = false,onChange,@@ -179,7 +179,6 @@ export function SelectWithValidation<position: "absolute",}}value={hiddenInputValue}-onChange={() => {}}// TODO:Not able to get focus to work// onFocus={() => selectRef.current?.focus()}diff --git a/packages/features/handleMarkNoShow.test.ts b/packages/features/handleMarkNoShow.test.tsindex 3b68211452d..90d1d11da30 100644--- a/packages/features/handleMarkNoShow.test.ts+++ b/packages/features/handleMarkNoShow.test.ts@@ -793,9 +793,9 @@ describe("handleMarkNoShow", () => {const call = mockOnNoShowUpdated.mock.calls[0][0];expect(call.auditData.attendeesNoShow).toHaveLength(2);- expect(call.auditData.attendeesNoShow.map((a: { attendeeEmail: string }) => a.attendeeEmail)).not.toContain(- );+ expect(+ call.auditData.attendeesNoShow.map((a: { attendeeEmail: string }) => a.attendeeEmail)+ ).not.toContain("[email protected]");});it("should not fire audit event when nothing changed", async () => {diff --git a/packages/features/handleMarkNoShow.ts b/packages/features/handleMarkNoShow.tsindex e4d39846bce..1d42815f20a 100644--- a/packages/features/handleMarkNoShow.ts+++ b/packages/features/handleMarkNoShow.ts@@ -110,7 +110,7 @@ const buildResultPayload = async ({attendees: NonNullable<TNoShowInputSchema["attendees"]>;t: TFunction;emailToAttendeeMap: EmailToAttendeeMap;-}): Promise<{message: string; attendees: NoShowAttendees}> => {+}): Promise<{ message: string; attendees: NoShowAttendees }> => {const updatedAttendees = await updateAttendees({ attendees, emailToAttendeeMap });if (updatedAttendees.length === 1) {@@ -241,7 +241,8 @@ async function fireNoShowUpdated({? await featuresRepository.checkIfTeamHasFeature(orgId, "booking-audit"): false;- const isSomethingChanged = auditData.host || (auditData.attendeesNoShow && auditData.attendeesNoShow.length > 0);+ const isSomethingChanged =+ auditData.host || (auditData.attendeesNoShow && auditData.attendeesNoShow.length > 0);if (isSomethingChanged) {await bookingEventHandlerService.onNoShowUpdated({bookingUid: booking.uid,@@ -448,7 +449,7 @@ const updateAttendees = async ({emailToAttendeeMap,}: {attendees: NonNullable<TNoShowInputSchema["attendees"]>;- emailToAttendeeMap: EmailToAttendeeMap;+ emailToAttendeeMap: EmailToAttendeeMap;}): Promise<NoShowAttendees> => {const attendeeRepository = new AttendeeRepository(prisma);const updatePromises = attendees.map((attendee) => {diff --git a/packages/features/hashedLink/lib/service/HashedLinkService.ts b/packages/features/hashedLink/lib/service/HashedLinkService.tsindex 62475a9223b..0a70cf4f463 100644--- a/packages/features/hashedLink/lib/service/HashedLinkService.ts+++ b/packages/features/hashedLink/lib/service/HashedLinkService.ts@@ -36,10 +36,10 @@ export class HashedLinkService {return typeof input === "string"? { link: input, expiresAt: null }: {- link: input.link,- expiresAt: input.expiresAt ?? null,- maxUsageCount: input.maxUsageCount,- };+ link: input.link,+ expiresAt: input.expiresAt ?? null,+ maxUsageCount: input.maxUsageCount,+ };}/**diff --git a/packages/features/holidays/repositories/HolidayRepository.test.ts b/packages/features/holidays/repositories/HolidayRepository.test.tsindex d44cb2750d5..a9243a0de3a 100644--- a/packages/features/holidays/repositories/HolidayRepository.test.ts+++ b/packages/features/holidays/repositories/HolidayRepository.test.ts@@ -323,4 +323,3 @@ describe("HolidayRepository", () => {});});});-diff --git a/packages/features/holidays/repositories/HolidayRepository.ts b/packages/features/holidays/repositories/HolidayRepository.tsindex 2259ec616c7..251d586cb4d 100644--- a/packages/features/holidays/repositories/HolidayRepository.ts+++ b/packages/features/holidays/repositories/HolidayRepository.ts@@ -214,4 +214,3 @@ export class HolidayRepository {});}}-diff --git a/packages/features/host/repositories/HostRepository.test.ts b/packages/features/host/repositories/HostRepository.test.tsindex c25581238ba..8871da8cf5a 100644--- a/packages/features/host/repositories/HostRepository.test.ts+++ b/packages/features/host/repositories/HostRepository.test.ts@@ -14,7 +14,9 @@ vi.mock("@calcom/prisma", () => {return {__esModule: true,default: mockPrisma,- PrismaClient: vi.fn().mockImplementation(function() { return mockPrisma; }),+ PrismaClient: vi.fn().mockImplementation(function () {+ return mockPrisma;+ }),};});diff --git a/packages/features/insights/lib/bookingUtils.ts b/packages/features/insights/lib/bookingUtils.tsindex e017be07ba6..8e308f82430 100644--- a/packages/features/insights/lib/bookingUtils.ts+++ b/packages/features/insights/lib/bookingUtils.ts@@ -8,10 +8,7 @@ export function extractDateRangeFromColumnFilters(columnFilters?: ColumnFilter[]for (const filter of columnFilters) {if ((filter.id === "startTime" || filter.id === "createdAt") && isDateRangeFilterValue(filter.value)) {- const dateFilter = filter.value as Extract<- ColumnFilter["value"],- { type: Extract<FilterType, "dr"> }- >;+ const dateFilter = filter.value as Extract<ColumnFilter["value"], { type: Extract<FilterType, "dr"> }>;if (dateFilter.data.startDate && dateFilter.data.endDate) {return {startDate: dateFilter.data.startDate,diff --git a/packages/features/insights/server/routing-events.ts b/packages/features/insights/server/routing-events.tsindex 54abb52b2a5..cd7aeaa74c8 100644--- a/packages/features/insights/server/routing-events.ts+++ b/packages/features/insights/server/routing-events.ts@@ -130,28 +130,31 @@ class RoutingEventsInsights {const dataWithFlatResponse = data.data.map((item) => {const bookingAttendees = item.bookingAttendees || [];- const fields = (headers || []).reduce((acc, header) => {- const id = header.id;- const field = item.fields.find((field) => field.fieldId === id);- if (!field) {- acc[header.label] = "";+ const fields = (headers || []).reduce(+ (acc, header) => {+ const id = header.id;+ const field = item.fields.find((field) => field.fieldId === id);+ if (!field) {+ acc[header.label] = "";+ return acc;+ }+ if (header.type === "select") {+ acc[header.label] = header.options?.find((option) => option.id === field.valueString)?.label;+ } else if (header.type === "multiselect" && Array.isArray(field.valueStringArray)) {+ acc[header.label] = field.valueStringArray+ .map((value) => header.options?.find((option) => option.id === value)?.label)+ .filter((label): label is string => label !== undefined)+ .sort()+ .join(", ");+ } else if (header.type === "number") {+ acc[header.label] = field.valueNumber?.toString() || "";+ } else {+ acc[header.label] = field.valueString || "";+ }return acc;- }- if (header.type === "select") {- acc[header.label] = header.options?.find((option) => option.id === field.valueString)?.label;- } else if (header.type === "multiselect" && Array.isArray(field.valueStringArray)) {- acc[header.label] = field.valueStringArray- .map((value) => header.options?.find((option) => option.id === value)?.label)- .filter((label): label is string => label !== undefined)- .sort()- .join(", ");- } else if (header.type === "number") {- acc[header.label] = field.valueNumber?.toString() || "";- } else {- acc[header.label] = field.valueString || "";- }- return acc;- }, {} as Record<string, string | undefined>);+ },+ {} as Record<string, string | undefined>+ );return {"Booking UID": item.bookingUid,@@ -195,10 +198,13 @@ class RoutingEventsInsights {utm_content: item.utm_content || "",...((bookingAttendees || []).filter((attendee) => typeof attendee.name === "string" && typeof attendee.email === "string")- .reduce((acc, attendee, index) => {- acc[`Attendee ${index + 1}`] = `${attendee.name} (${attendee.email})`;- return acc;- }, {} as Record<string, string>) || {}),+ .reduce(+ (acc, attendee, index) => {+ acc[`Attendee ${index + 1}`] = `${attendee.name} (${attendee.email})`;+ return acc;+ },+ {} as Record<string, string>+ ) || {}),};});diff --git a/packages/features/insights/services/InsightsBookingBaseService.ts b/packages/features/insights/services/InsightsBookingBaseService.tsindex ef52bd6f503..9de009e602e 100644--- a/packages/features/insights/services/InsightsBookingBaseService.ts+++ b/packages/features/insights/services/InsightsBookingBaseService.ts@@ -25,7 +25,7 @@ import { transformBookingsForCsv, type BookingTimeStatusData } from "./csvDataTr// Utility function to build user hash map with avatar URL fallbackexport const buildHashMapForUsers = <- T extends { avatarUrl: string | null; id: number; username: string | null; [key: string]: unknown }+ T extends { avatarUrl: string | null; id: number; username: string | null; [key: string]: unknown },>(usersFromTeam: T[]) => {@@ -176,12 +176,13 @@ export class InsightsBookingBaseService {ORDER BY 1`;- const results = await this.prisma.$queryRaw<- Array<{- hour: string;- count: number;- }>- >(query);+ const results =+ await this.prisma.$queryRaw<+ Array<{+ hour: string;+ count: number;+ }>+ >(query);// Create a map of results by hour for easy lookupconst resultsMap = new Map(results.map((row) => [Number(row.hour), row.count]));@@ -522,25 +523,26 @@ export class InsightsBookingBaseService {OFFSET ${offset}`;- const csvData = await this.prisma.$queryRaw<- Array<{- id: number;- uid: string | null;- title: string;- createdAt: Date;- timeStatus: string;- eventTypeId: number | null;- eventLength: number;- startTime: Date;- endTime: Date;- paid: boolean;- userEmail: string;- userUsername: string;- rating: number | null;- ratingFeedback: string | null;- noShowHost: boolean;- }>- >(csvDataQuery);+ const csvData =+ await this.prisma.$queryRaw<+ Array<{+ id: number;+ uid: string | null;+ title: string;+ createdAt: Date;+ timeStatus: string;+ eventTypeId: number | null;+ eventLength: number;+ startTime: Date;+ endTime: Date;+ paid: boolean;+ userEmail: string;+ userUsername: string;+ rating: number | null;+ ratingFeedback: string | null;+ noShowHost: boolean;+ }>+ >(csvDataQuery);if (csvData.length === 0) {return { data: csvData, total: totalCount };@@ -652,15 +654,16 @@ export class InsightsBookingBaseService {ORDER BY bs."date"`;- const data = await this.prisma.$queryRaw<- {- date: Date;- bookingsCount: number;- timeStatus: string;- noShowHost: boolean;- noShowGuests: number;- }[]- >(query);+ const data =+ await this.prisma.$queryRaw<+ {+ date: Date;+ bookingsCount: number;+ timeStatus: string;+ noShowHost: boolean;+ noShowGuests: number;+ }[]+ >(query);// Initialize aggregate object with zero counts for all date rangesconst aggregate: {@@ -762,12 +765,13 @@ export class InsightsBookingBaseService {LIMIT 10`;- const bookingsFromSelected = await this.prisma.$queryRaw<- Array<{- eventTypeId: number;- count: number;- }>- >(query);+ const bookingsFromSelected =+ await this.prisma.$queryRaw<+ Array<{+ eventTypeId: number;+ count: number;+ }>+ >(query);const eventTypeIds = bookingsFromSelected.map((booking) => booking.eventTypeId);@@ -868,12 +872,13 @@ export class InsightsBookingBaseService {LIMIT 10`;- const bookingsFromTeam = await this.prisma.$queryRaw<- Array<{- userId: number;- count: number;- }>- >(query);+ const bookingsFromTeam =+ await this.prisma.$queryRaw<+ Array<{+ userId: number;+ count: number;+ }>+ >(query);if (bookingsFromTeam.length === 0) {return [];@@ -931,12 +936,13 @@ export class InsightsBookingBaseService {LIMIT 10`;- const bookingsFromTeam = await this.prisma.$queryRaw<- Array<{- userId: number;- count: number;- }>- >(query);+ const bookingsFromTeam =+ await this.prisma.$queryRaw<+ Array<{+ userId: number;+ count: number;+ }>+ >(query);if (bookingsFromTeam.length === 0) {return [];@@ -994,13 +1000,14 @@ export class InsightsBookingBaseService {LIMIT 10`;- const bookingsFromTeam = await this.prisma.$queryRaw<- Array<{- userId: number | null;- rating: number | null;- ratingFeedback: string | null;- }>- >(query);+ const bookingsFromTeam =+ await this.prisma.$queryRaw<+ Array<{+ userId: number | null;+ rating: number | null;+ ratingFeedback: string | null;+ }>+ >(query);if (bookingsFromTeam.length === 0) {return [];@@ -1092,19 +1099,20 @@ export class InsightsBookingBaseService {FROM booking_stats bs, guest_stats gs`;- const stats = await this.prisma.$queryRaw<- Array<{- total_bookings: bigint;- completed_bookings: bigint;- rescheduled_bookings: bigint;- cancelled_bookings: bigint;- no_show_host_bookings: bigint;- avg_rating: number | null;- total_ratings: bigint;- ratings_above_3: bigint;- no_show_guests: bigint;- }>- >(query);+ const stats =+ await this.prisma.$queryRaw<+ Array<{+ total_bookings: bigint;+ completed_bookings: bigint;+ rescheduled_bookings: bigint;+ cancelled_bookings: bigint;+ no_show_host_bookings: bigint;+ avg_rating: number | null;+ total_ratings: bigint;+ ratings_above_3: bigint;+ no_show_guests: bigint;+ }>+ >(query);const rawStats = stats[0];return rawStats@@ -1173,15 +1181,16 @@ export class InsightsBookingBaseService {LIMIT 10`;- const recentNoShowBookings = await this.prisma.$queryRaw<- Array<{- bookingId: number;- startTime: Date;- eventTypeName: string;- guestName: string;- guestEmail: string;- }>- >(query);+ const recentNoShowBookings =+ await this.prisma.$queryRaw<+ Array<{+ bookingId: number;+ startTime: Date;+ eventTypeName: string;+ guestName: string;+ guestEmail: string;+ }>+ >(query);return recentNoShowBookings;}@@ -1221,12 +1230,13 @@ export class InsightsBookingBaseService {ORDER BY 1`;- const data = await this.prisma.$queryRaw<- {- date: Date;- count: number;- }[]- >(query);+ const data =+ await this.prisma.$queryRaw<+ {+ date: Date;+ count: number;+ }[]+ >(query);// Initialize aggregate object with zero counts for all date rangesconst aggregate: { [date: string]: number } = {};@@ -1279,13 +1289,14 @@ export class InsightsBookingBaseService {ORDER BY 1`;- const data = await this.prisma.$queryRaw<- {- date: Date;- ratings_above_3: number;- total_ratings: number;- }[]- >(query);+ const data =+ await this.prisma.$queryRaw<+ {+ date: Date;+ ratings_above_3: number;+ total_ratings: number;+ }[]+ >(query);// Initialize aggregate object with zero counts for all date rangesconst aggregate: { [date: string]: { ratingsAbove3: number; totalRatings: number } } = {};diff --git a/packages/features/insights/services/InsightsRoutingBaseService.ts b/packages/features/insights/services/InsightsRoutingBaseService.tsindex 95dfca8eb66..89a2d3991e9 100644--- a/packages/features/insights/services/InsightsRoutingBaseService.ts+++ b/packages/features/insights/services/InsightsRoutingBaseService.ts@@ -204,14 +204,15 @@ export class InsightsRoutingBaseService {ORDER BY "dateRange"`;- const results = await this.prisma.$queryRaw<- Array<{- dateRange: string | null;- totalSubmissions: bigint;- successfulRoutings: bigint;- acceptedBookings: bigint;- }>- >(query);+ const results =+ await this.prisma.$queryRaw<+ Array<{+ dateRange: string | null;+ totalSubmissions: bigint;+ successfulRoutings: bigint;+ acceptedBookings: bigint;+ }>+ >(query);// Create a map of results by dateRange for easy lookupconst resultsMap = new Map(@@ -379,9 +380,8 @@ export class InsightsRoutingBaseService {WHERE (${baseConditions}) AND ("bookingUid" IS NULL)`;- const totalWithoutBookingResult = await this.prisma.$queryRaw<Array<{ count: bigint }>>(- totalWithoutBookingQuery- );+ const totalWithoutBookingResult =+ await this.prisma.$queryRaw<Array<{ count: bigint }>>(totalWithoutBookingQuery);const total = Number(totalResult[0]?.count || 0);const totalWithoutBooking = Number(totalWithoutBookingResult[0]?.count || 0);@@ -465,14 +465,15 @@ export class InsightsRoutingBaseService {${limit ? Prisma.sql`LIMIT ${limit}` : Prisma.empty}`;- const usersQuery = await this.prisma.$queryRaw<- Array<{- id: number;- name: string | null;- email: string | null;- avatarUrl: string | null;- }>- >(usersQuerySql);+ const usersQuery =+ await this.prisma.$queryRaw<+ Array<{+ id: number;+ name: string | null;+ email: string | null;+ avatarUrl: string | null;+ }>+ >(usersQuerySql);const users = usersQuery;@@ -552,13 +553,14 @@ export class InsightsRoutingBaseService {ORDER BY c.period_start ASC, c."userId" ASC`;- const periodStats = await this.prisma.$queryRaw<- Array<{- userId: number;- period_start: Date;- total: number;- }>- >(periodStatsQuery);+ const periodStats =+ await this.prisma.$queryRaw<+ Array<{+ userId: number;+ period_start: Date;+ total: number;+ }>+ >(periodStatsQuery);// Get statistics for the entire period for comparisonconst statsQuerySql = Prisma.sql`@@ -574,12 +576,13 @@ export class InsightsRoutingBaseService {ORDER BY total_bookings ASC`;- const statsQuery = await this.prisma.$queryRaw<- Array<{- userId: number;- total_bookings: number;- }>- >(statsQuerySql);+ const statsQuery =+ await this.prisma.$queryRaw<+ Array<{+ userId: number;+ total_bookings: number;+ }>+ >(statsQuerySql);// Calculate average and medianconst average =@@ -587,20 +590,26 @@ export class InsightsRoutingBaseService {const median = statsQuery[Math.floor(statsQuery.length / 2)]?.total_bookings || 0;// Create a map of user performance indicators- const userPerformance = statsQuery.reduce((acc, stat) => {- acc[stat.userId] = {- total: stat.total_bookings,- performance:- stat.total_bookings > average- ? "above_average"- : stat.total_bookings === median- ? "median"- : stat.total_bookings < average- ? "below_average"- : "at_average",- };- return acc;- }, {} as Record<number, { total: number; performance: "above_average" | "at_average" | "below_average" | "median" }>);+ const userPerformance = statsQuery.reduce(+ (acc, stat) => {+ acc[stat.userId] = {+ total: stat.total_bookings,+ performance:+ stat.total_bookings > average+ ? "above_average"+ : stat.total_bookings === median+ ? "median"+ : stat.total_bookings < average+ ? "below_average"+ : "at_average",+ };+ return acc;+ },+ {} as Record<+ number,+ { total: number; performance: "above_average" | "at_average" | "below_average" | "median" }+ >+ );return {users: {@@ -702,10 +711,13 @@ export class InsightsRoutingBaseService {// Extract specific filters from columnFilters// Convert columnFilters array to object for easier accessconst filtersMap =- columnFilters.reduce((acc, filter) => {- acc[filter.id] = filter;- return acc;- }, {} as Record<string, TypedColumnFilter<FilterType>>) || {};+ columnFilters.reduce(+ (acc, filter) => {+ acc[filter.id] = filter;+ return acc;+ },+ {} as Record<string, TypedColumnFilter<FilterType>>+ ) || {};// Extract booking status order filterconst bookingStatusOrder = filtersMap["bookingStatusOrder"];@@ -1033,31 +1045,35 @@ export class InsightsRoutingBaseService {ORDER BY count DESC`;- const result = await this.prisma.$queryRaw<- {- formId: string;- formName: string;- fieldId: string;- fieldLabel: string;- optionId: string;- optionLabel: string;- count: number;- }[]- >(query);+ const result =+ await this.prisma.$queryRaw<+ {+ formId: string;+ formName: string;+ fieldId: string;+ fieldLabel: string;+ optionId: string;+ optionLabel: string;+ count: number;+ }[]+ >(query);// First group by form and field- const groupedByFormAndField = result.reduce((acc, curr) => {- const formKey = curr.formName;- acc[formKey] = acc[formKey] || {};- const labelKey = curr.fieldLabel;- acc[formKey][labelKey] = acc[formKey][labelKey] || [];- acc[formKey][labelKey].push({- optionId: curr.optionId,- count: curr.count,- optionLabel: curr.optionLabel,- });- return acc;- }, {} as Record<string, Record<string, { optionId: string; count: number; optionLabel: string }[]>>);+ const groupedByFormAndField = result.reduce(+ (acc, curr) => {+ const formKey = curr.formName;+ acc[formKey] = acc[formKey] || {};+ const labelKey = curr.fieldLabel;+ acc[formKey][labelKey] = acc[formKey][labelKey] || [];+ acc[formKey][labelKey].push({+ optionId: curr.optionId,+ count: curr.count,+ optionLabel: curr.optionLabel,+ });+ return acc;+ },+ {} as Record<string, Record<string, { optionId: string; count: number; optionLabel: string }[]>>+ );// NOTE: totalCount represents the sum of all response counts across all fields and options for a form// For example, if a form has 2 fields with 2 options each:@@ -1075,10 +1091,13 @@ export class InsightsRoutingBaseService {.sort((a, b) => b.totalCount - a.totalCount);// Convert back to original format- const sortedGroupedByFormAndField = sortedEntries.reduce((acc, { formName, fields }) => {- acc[formName] = fields;- return acc;- }, {} as Record<string, Record<string, { optionId: string; count: number; optionLabel: string }[]>>);+ const sortedGroupedByFormAndField = sortedEntries.reduce(+ (acc, { formName, fields }) => {+ acc[formName] = fields;+ return acc;+ },+ {} as Record<string, Record<string, { optionId: string; count: number; optionLabel: string }[]>>+ );return sortedGroupedByFormAndField;}diff --git a/packages/features/insights/services/__tests__/csvDataTransformer.test.ts b/packages/features/insights/services/__tests__/csvDataTransformer.test.tsindex 63d8dfd9f65..8c4ac068189 100644--- a/packages/features/insights/services/__tests__/csvDataTransformer.test.ts+++ b/packages/features/insights/services/__tests__/csvDataTransformer.test.ts@@ -207,9 +207,7 @@ describe("csvDataTransformer", () => {const createBooking = (overrides: Partial<BookingWithAttendees> = {}): BookingWithAttendees => ({uid: "test-uid",eventTypeId: 1,- attendees: [- { name: "John Doe", email: "[email protected]", phoneNumber: null, noShow: false },- ],+ attendees: [{ name: "John Doe", email: "[email protected]", phoneNumber: null, noShow: false }],seatsReferences: [],responses: {},eventType: { bookingFields: [] },@@ -227,10 +225,7 @@ describe("csvDataTransformer", () => {const result = processBookingAttendees(booking, null, null, false);- expect(result.attendeeList).toEqual([- "John Doe ([email protected])",- "Jane Smith ([email protected])",- ]);+ expect(result.attendeeList).toEqual(["John Doe ([email protected])", "Jane Smith ([email protected])"]);expect(result.attendeePhoneNumbers).toEqual(["+1234567890", null]);});@@ -260,10 +255,7 @@ describe("csvDataTransformer", () => {const result = processBookingAttendees(booking, null, null, true);- expect(result.attendeeList).toEqual([- "Seat 1 ([email protected])",- "Seat 2 ([email protected])",- ]);+ expect(result.attendeeList).toEqual(["Seat 1 ([email protected])", "Seat 2 ([email protected])"]);expect(result.noShowGuests).toBe("Seat 2 ([email protected])");});@@ -293,9 +285,7 @@ describe("csvDataTransformer", () => {it("should use system phone as fallback for attendee phone", () => {const booking = createBooking({- attendees: [- { name: "John Doe", email: "[email protected]", phoneNumber: null, noShow: false },- ],+ attendees: [{ name: "John Doe", email: "[email protected]", phoneNumber: null, noShow: false }],responses: {attendeePhoneNumber: "+1234567890",},@@ -308,9 +298,7 @@ describe("csvDataTransformer", () => {it("should use custom phone field as fallback when system phone not available", () => {const booking = createBooking({- attendees: [- { name: "John Doe", email: "[email protected]", phoneNumber: null, noShow: false },- ],+ attendees: [{ name: "John Doe", email: "[email protected]", phoneNumber: null, noShow: false }],responses: {customPhone: "+9876543210",},@@ -361,9 +349,7 @@ describe("csvDataTransformer", () => {{uid: "booking-1",eventTypeId: 1,- attendees: [- { name: "A1", email: "[email protected]", phoneNumber: null, noShow: false },- ],+ attendees: [{ name: "A1", email: "[email protected]", phoneNumber: null, noShow: false }],seatsReferences: [],responses: {},eventType: { bookingFields: [] },@@ -478,7 +464,9 @@ describe("csvDataTransformer", () => {});describe("formatCsvRow", () => {- const createBookingTimeStatus = (overrides: Partial<BookingTimeStatusData> = {}): BookingTimeStatusData => ({+ const createBookingTimeStatus = (+ overrides: Partial<BookingTimeStatusData> = {}+ ): BookingTimeStatusData => ({id: 1,uid: "test-uid",title: "Test Meeting",@@ -500,13 +488,7 @@ describe("csvDataTransformer", () => {it("should format dates correctly for timezone", () => {const bookingTimeStatus = createBookingTimeStatus();- const result = formatCsvRow(- bookingTimeStatus,- null,- 0,- new Set(),- "America/New_York"- );+ const result = formatCsvRow(bookingTimeStatus, null, 0, new Set(), "America/New_York");expect(result.createdAt).toBe("2024-01-15T10:00:00.000Z");expect(result.createdAt_date).toBe("2024-01-15");@@ -523,13 +505,7 @@ describe("csvDataTransformer", () => {bookingQuestionResponses: {},};- const result = formatCsvRow(- bookingTimeStatus,- processedData,- 3,- new Set(),- "UTC"- );+ const result = formatCsvRow(bookingTimeStatus, processedData, 3, new Set(), "UTC");expect(result.attendee1).toBe("John ([email protected])");expect(result.attendeePhone1).toBe("+111");@@ -601,21 +577,9 @@ describe("csvDataTransformer", () => {},};- const allLabels = new Set([- "Company",- "Job Title",- "Budget",- "Meeting Purpose",- "Additional Notes",- ]);+ const allLabels = new Set(["Company", "Job Title", "Budget", "Meeting Purpose", "Additional Notes"]);- const result = formatCsvRow(- bookingTimeStatus,- processedData,- 3,- allLabels,- "America/Los_Angeles"- );+ const result = formatCsvRow(bookingTimeStatus, processedData, 3, allLabels, "America/Los_Angeles");expect(result).toMatchSnapshot();});@@ -710,17 +674,24 @@ describe("csvDataTransformer", () => {eventTypeId: 2,attendees: [],seatsReferences: [- { attendee: { name: "Participant 1", email: "[email protected]", phoneNumber: null, noShow: false } },+ {+ attendee: { name: "Participant 1", email: "[email protected]", phoneNumber: null, noShow: false },+ },{ attendee: { name: "Participant 2", email: "[email protected]", phoneNumber: null, noShow: true } },- { attendee: { name: "Participant 3", email: "[email protected]", phoneNumber: "+9876543210", noShow: false } },+ {+ attendee: {+ name: "Participant 3",+ email: "[email protected]",+ phoneNumber: "+9876543210",+ noShow: false,+ },+ },],responses: {emergencyContact: "+5555555555",},eventType: {- bookingFields: [- { name: "emergencyContact", type: "phone", label: "Emergency Contact" },- ],+ bookingFields: [{ name: "emergencyContact", type: "phone", label: "Emergency Contact" }],},tracking: null,},diff --git a/packages/features/insights/services/csvDataTransformer.ts b/packages/features/insights/services/csvDataTransformer.tsindex 21e5233ef53..3bf5d4018e2 100644--- a/packages/features/insights/services/csvDataTransformer.ts+++ b/packages/features/insights/services/csvDataTransformer.ts@@ -90,9 +90,7 @@ export function isSystemField(fieldName: string): boolean {return SystemField.safeParse(fieldName).success;}-export function getPhoneFieldsForSeatedEvent(- bookingFields: unknown-): BookingFieldInfo[] | null {+export function getPhoneFieldsForSeatedEvent(bookingFields: unknown): BookingFieldInfo[] | null {const parsed = eventTypeBookingFields.safeParse(bookingFields);if (!parsed.success) return null;@@ -188,10 +186,7 @@ export function processBookingAttendees(export function processBookingsForCsv(bookings: BookingWithAttendees[]): ProcessBookingsResult {const phoneFieldsCache = new Map<number, BookingFieldInfo[]>();- const allFieldsCache = new Map<- number,- { fields: BookingFieldInfo[]; phoneFieldNames: Set<string> }- >();+ const allFieldsCache = new Map<number, { fields: BookingFieldInfo[]; phoneFieldNames: Set<string> }>();const allBookingQuestionLabels = new Set<string>();let maxAttendees = 0;const bookingMap = new Map<string, ProcessedBookingData>();@@ -231,12 +226,7 @@ export function processBookingsForCsv(bookings: BookingWithAttendees[]): Process}}- const processedData = processBookingAttendees(- booking,- bookingFields,- phoneFieldNames,- isSeatedEvent- );+ const processedData = processBookingAttendees(booking, bookingFields, phoneFieldNames, isSeatedEvent);if (processedData.attendeeList.length > maxAttendees) {maxAttendees = processedData.attendeeList.length;diff --git a/packages/features/oauth/repositories/OAuthClientRepository.ts b/packages/features/oauth/repositories/OAuthClientRepository.tsindex e29118c1ac4..de776327f95 100644--- a/packages/features/oauth/repositories/OAuthClientRepository.ts+++ b/packages/features/oauth/repositories/OAuthClientRepository.ts@@ -1,6 +1,5 @@import { randomBytes } from "node:crypto";-import type { PrismaClient } from "@calcom/prisma";import type { OAuthClientStatus } from "@calcom/prisma/enums";diff --git a/packages/features/oauth/services/OAuthService.ts b/packages/features/oauth/services/OAuthService.tsindex f0d408ad89e..f833f095df0 100644--- a/packages/features/oauth/services/OAuthService.ts+++ b/packages/features/oauth/services/OAuthService.ts@@ -175,7 +175,9 @@ export class OAuthService {private ensureClientIsApproved(client: { status: OAuthClientStatus }): void {if (client.status !== OAuthClientStatus.APPROVED) {- throw new ErrorWithCode(ErrorCode.Unauthorized, "unauthorized_client", { reason: "client_not_approved" });+ throw new ErrorWithCode(ErrorCode.Unauthorized, "unauthorized_client", {+ reason: "client_not_approved",+ });}}diff --git a/packages/features/pbac/domain/errors/role-management.error.ts b/packages/features/pbac/domain/errors/role-management.error.tsindex f41f0c35c73..addf731f11b 100644--- a/packages/features/pbac/domain/errors/role-management.error.ts+++ b/packages/features/pbac/domain/errors/role-management.error.ts@@ -1,5 +1,8 @@export class RoleManagementError extends Error {- constructor(message: string, public readonly code: RoleManagementErrorCode) {+ constructor(+ message: string,+ public readonly code: RoleManagementErrorCode+ ) {super(message);this.name = "RoleManagementError";}diff --git a/packages/features/pbac/lib/__tests__/event-type-permissions.test.ts b/packages/features/pbac/lib/__tests__/event-type-permissions.test.tsindex b9f276854df..ebb59275335 100644--- a/packages/features/pbac/lib/__tests__/event-type-permissions.test.ts+++ b/packages/features/pbac/lib/__tests__/event-type-permissions.test.ts@@ -35,8 +35,12 @@ describe("getEventTypePermissions", () => {getResourcePermissions: vi.fn(),};- vi.mocked(FeaturesRepository).mockImplementation(function() { return mockFeaturesRepository as any; });- vi.mocked(PermissionCheckService).mockImplementation(function() { return mockPermissionCheckService as any; });+ vi.mocked(FeaturesRepository).mockImplementation(function () {+ return mockFeaturesRepository as any;+ });+ vi.mocked(PermissionCheckService).mockImplementation(function () {+ return mockPermissionCheckService as any;+ });prisma.membership.findFirst = vi.fn();prisma.team.findUnique = vi.fn();@@ -546,8 +550,12 @@ describe("getEventTypePermissions", () => {vi.clearAllMocks();// Re-initialize mocks after clearing- vi.mocked(FeaturesRepository).mockImplementation(function() { return mockFeaturesRepository as any; });- vi.mocked(PermissionCheckService).mockImplementation(function() { return mockPermissionCheckService as any; });+ vi.mocked(FeaturesRepository).mockImplementation(function () {+ return mockFeaturesRepository as any;+ });+ vi.mocked(PermissionCheckService).mockImplementation(function () {+ return mockPermissionCheckService as any;+ });prisma.membership.findFirst = vi.fn();prisma.team.findUnique = vi.fn();diff --git a/packages/features/pbac/lib/__tests__/resource-permissions.test.ts b/packages/features/pbac/lib/__tests__/resource-permissions.test.tsindex bc1298f73a7..d9c8f8efa49 100644--- a/packages/features/pbac/lib/__tests__/resource-permissions.test.ts+++ b/packages/features/pbac/lib/__tests__/resource-permissions.test.ts@@ -42,9 +42,13 @@ describe("getResourcePermissions", () => {};// eslint-disable-next-line @typescript-eslint/no-explicit-any- vi.mocked(FeaturesRepository).mockImplementation(function() { return mockFeaturesRepository as any; });+ vi.mocked(FeaturesRepository).mockImplementation(function () {+ return mockFeaturesRepository as any;+ });// eslint-disable-next-line @typescript-eslint/no-explicit-any- vi.mocked(PermissionCheckService).mockImplementation(function() { return mockPermissionCheckService as any; });+ vi.mocked(PermissionCheckService).mockImplementation(function () {+ return mockPermissionCheckService as any;+ });});describe("when PBAC is disabled", () => {diff --git a/packages/features/pbac/services/role.service.ts b/packages/features/pbac/services/role.service.tsindex 25887833960..f73e1c578cf 100644--- a/packages/features/pbac/services/role.service.ts+++ b/packages/features/pbac/services/role.service.ts@@ -44,9 +44,9 @@ export class RoleService {async assignRoleToMember(roleId: string, membershipId: number) {const role = await this.repository.findById(roleId);if (!role) throw new Error("Role not found");-+const membershipRole = this.getMembershipRoleFromRoleId(roleId);-+await db.membership.update({where: { id: membershipId },data: {diff --git a/packages/features/pbac/utils/permissionTraversal.ts b/packages/features/pbac/utils/permissionTraversal.tsindex 70f08924372..9e1c6c39bf4 100644--- a/packages/features/pbac/utils/permissionTraversal.ts+++ b/packages/features/pbac/utils/permissionTraversal.ts@@ -120,7 +120,10 @@ export const traversePermissions = (* @param scope The scope to use for permission registry (defaults to Organization)* @returns Array of dependency permissions*/-export const getTransitiveDependencies = (permission: string, scope: Scope = Scope.Organization): string[] => {+export const getTransitiveDependencies = (+ permission: string,+ scope: Scope = Scope.Organization+): string[] => {return traversePermissions(permission, "dependencies", scope);};diff --git a/packages/features/routing-forms/di/tokens.ts b/packages/features/routing-forms/di/tokens.tsindex fdd070bf4f9..252a0085d42 100644--- a/packages/features/routing-forms/di/tokens.ts+++ b/packages/features/routing-forms/di/tokens.ts@@ -1,4 +1,4 @@export const ROUTING_FORM_DI_TOKENS = {- ROUTING_FORM_RESPONSE_REPOSITORY: Symbol("RoutingFormResponseRepository"),- ROUTING_FORM_RESPONSE_REPOSITORY_MODULE: Symbol("RoutingFormResponseRepositoryModule"),+ ROUTING_FORM_RESPONSE_REPOSITORY: Symbol("RoutingFormResponseRepository"),+ ROUTING_FORM_RESPONSE_REPOSITORY_MODULE: Symbol("RoutingFormResponseRepositoryModule"),};diff --git a/packages/features/routing-forms/lib/findFieldValueByIdentifier.ts b/packages/features/routing-forms/lib/findFieldValueByIdentifier.tsindex 1485a17d7e9..de7ef90bf26 100644--- a/packages/features/routing-forms/lib/findFieldValueByIdentifier.ts+++ b/packages/features/routing-forms/lib/findFieldValueByIdentifier.ts@@ -18,4 +18,3 @@ export function findFieldValueByIdentifier(return { success: true, data: fieldValue ?? null };}-diff --git a/packages/features/routing-forms/lib/findTeamMembersMatchingAttributeLogic.ts b/packages/features/routing-forms/lib/findTeamMembersMatchingAttributeLogic.tsindex 075571581fc..2309762ab90 100644--- a/packages/features/routing-forms/lib/findTeamMembersMatchingAttributeLogic.ts+++ b/packages/features/routing-forms/lib/findTeamMembersMatchingAttributeLogic.ts@@ -479,7 +479,12 @@ export async function findTeamMembersMatchingAttributeLogic(} = {}) {// Higher value of concurrency might not be performant as it might overwhelm the system. So, use a lower value as default.- const { enablePerf = false, concurrency = 2, enableTroubleshooter = false, routingFormTraceService } = options;+ const {+ enablePerf = false,+ concurrency = 2,+ enableTroubleshooter = false,+ routingFormTraceService,+ } = options;// Any explicit value being passed should cause fallback to be considered. Even undefinedconst considerFallback = "fallbackAttributesQueryValue" in data;diff --git a/packages/features/routing-forms/lib/getFieldIdentifier.ts b/packages/features/routing-forms/lib/getFieldIdentifier.tsindex a7f7332572f..fab66fe8c8d 100644--- a/packages/features/routing-forms/lib/getFieldIdentifier.ts+++ b/packages/features/routing-forms/lib/getFieldIdentifier.ts@@ -3,4 +3,3 @@ import type { Field } from "./types";const getFieldIdentifier = (field: Field) => field.identifier || field.label;export default getFieldIdentifier;-diff --git a/packages/features/routing-forms/lib/getFieldResponseByIdentifier.ts b/packages/features/routing-forms/lib/getFieldResponseByIdentifier.tsindex 3e26e03b2d6..06f7f190576 100644--- a/packages/features/routing-forms/lib/getFieldResponseByIdentifier.ts+++ b/packages/features/routing-forms/lib/getFieldResponseByIdentifier.ts@@ -2,15 +2,15 @@ import { parseRoutingFormResponse } from "./parseRoutingFormResponse";import { findFieldValueByIdentifier } from "./findFieldValueByIdentifier";export const getFieldResponseByIdentifier = ({- responsePayload,- formFields,- identifier,+ responsePayload,+ formFields,+ identifier,}: {- responsePayload: unknown;- formFields: unknown;- identifier: string;+ responsePayload: unknown;+ formFields: unknown;+ identifier: string;}) => {- const parsedResponse = parseRoutingFormResponse(responsePayload, formFields);- const emailFieldResult = findFieldValueByIdentifier(parsedResponse, identifier);- return emailFieldResult;-};\ No newline at end of file+ const parsedResponse = parseRoutingFormResponse(responsePayload, formFields);+ const emailFieldResult = findFieldValueByIdentifier(parsedResponse, identifier);+ return emailFieldResult;+};diff --git a/packages/features/routing-forms/lib/parseRoutingFormResponse.ts b/packages/features/routing-forms/lib/parseRoutingFormResponse.tsindex 732231fa049..610b311651c 100644--- a/packages/features/routing-forms/lib/parseRoutingFormResponse.ts+++ b/packages/features/routing-forms/lib/parseRoutingFormResponse.ts@@ -2,8 +2,7 @@ import { zodNonRouterField, routingFormResponseInDbSchema } from "./zod";import type { RoutingFormResponseData } from "./types";export function parseRoutingFormResponse(rawResponse: unknown, formFields: unknown): RoutingFormResponseData {- const response = routingFormResponseInDbSchema.parse(rawResponse);- const fields = zodNonRouterField.array().parse(formFields);- return { response, fields };+ const response = routingFormResponseInDbSchema.parse(rawResponse);+ const fields = zodNonRouterField.array().parse(formFields);+ return { response, fields };}-diff --git a/packages/features/routing-forms/lib/types.ts b/packages/features/routing-forms/lib/types.tsindex 4664d98beba..a4063afb43c 100644--- a/packages/features/routing-forms/lib/types.ts+++ b/packages/features/routing-forms/lib/types.ts@@ -19,4 +19,3 @@ export type RoutingFormResponseData = {fields: z.infer<typeof zodNonRouterField>[];response: z.infer<typeof routingFormResponseInDbSchema>;};-diff --git a/packages/features/routing-forms/lib/zod.ts b/packages/features/routing-forms/lib/zod.tsindex 012fdddab49..f3133267e8a 100644--- a/packages/features/routing-forms/lib/zod.ts+++ b/packages/features/routing-forms/lib/zod.ts@@ -1,56 +1,55 @@import { z } from "zod";export type FieldOption = {- label: string;- id: string | null;+ label: string;+ id: string | null;};export type TNonRouterField = {- id: string;- label: string;- identifier?: string;- placeholder?: string;- type: string;- /** @deprecated in favour of `options` */- selectText?: string;- required?: boolean;- deleted?: boolean;- options?: FieldOption[];+ id: string;+ label: string;+ identifier?: string;+ placeholder?: string;+ type: string;+ /** @deprecated in favour of `options` */+ selectText?: string;+ required?: boolean;+ deleted?: boolean;+ options?: FieldOption[];};// Note: zodNonRouterField is NOT annotated with z.ZodType because it uses .extend() below// which requires the full ZodObject type to be preservedexport const zodNonRouterField = z.object({- id: z.string(),- label: z.string(),- identifier: z.string().optional(),- placeholder: z.string().optional(),- type: z.string(),- /**- * @deprecated in favour of `options`- */- selectText: z.string().optional(),- required: z.boolean().optional(),- deleted: z.boolean().optional(),- options: z- .array(- z.object({- label: z.string(),- // To keep backwards compatibility with the options generated from legacy selectText, we allow saving null as id- // It helps in differentiating whether the routing logic should consider the option.label as value or option.id as value.- // This is important for legacy routes which has option.label saved in conditions and it must keep matching with the value of the option- id: z.string().or(z.null()),- })- )- .optional(),+ id: z.string(),+ label: z.string(),+ identifier: z.string().optional(),+ placeholder: z.string().optional(),+ type: z.string(),+ /**+ * @deprecated in favour of `options`+ */+ selectText: z.string().optional(),+ required: z.boolean().optional(),+ deleted: z.boolean().optional(),+ options: z+ .array(+ z.object({+ label: z.string(),+ // To keep backwards compatibility with the options generated from legacy selectText, we allow saving null as id+ // It helps in differentiating whether the routing logic should consider the option.label as value or option.id as value.+ // This is important for legacy routes which has option.label saved in conditions and it must keep matching with the value of the option+ id: z.string().or(z.null()),+ })+ )+ .optional(),});// This is different from FormResponse in types.d.ts in that it has label optional. We don't seem to be using label at this point, so we might want to use this only while saving the response when Routing Form is submitted// Record key is formFieldIdexport const routingFormResponseInDbSchema = z.record(- z.object({- label: z.string().optional(),- value: z.union([z.string(), z.number(), z.array(z.string())]),- })+ z.object({+ label: z.string().optional(),+ value: z.union([z.string(), z.number(), z.array(z.string())]),+ }));-diff --git a/packages/features/routing-trace/components/DomainIcon.tsx b/packages/features/routing-trace/components/DomainIcon.tsxindex 20871e92fe7..d2f85de3c18 100644--- a/packages/features/routing-trace/components/DomainIcon.tsx+++ b/packages/features/routing-trace/components/DomainIcon.tsx@@ -4,8 +4,15 @@ import { ROUTING_TRACE_DOMAINS } from "../constants";import type { IconName } from "@calcom/ui/components/icon";-const DOMAIN_ICONS: Record<string, { type: "icon"; name: IconName } | { type: "img"; src: string; alt: string }> = {- [ROUTING_TRACE_DOMAINS.SALESFORCE]: { type: "img", src: "/app-store/salesforce/icon.png", alt: "Salesforce" },+const DOMAIN_ICONS: Record<+ string,+ { type: "icon"; name: IconName } | { type: "img"; src: string; alt: string }+> = {+ [ROUTING_TRACE_DOMAINS.SALESFORCE]: {+ type: "img",+ src: "/app-store/salesforce/icon.png",+ alt: "Salesforce",+ },[ROUTING_TRACE_DOMAINS.ROUTING_FORM]: { type: "icon", name: "file-text" },};@@ -18,10 +25,5 @@ export function DomainIcon({ domain }: { domain: string }) {return <img src={config.src} alt={config.alt} className="h-4 w-4" />;}- return (- <Icon- name={config?.type === "icon" ? config.name : DEFAULT_ICON}- className="text-subtle h-4 w-4"- />- );+ return <Icon name={config?.type === "icon" ? config.name : DEFAULT_ICON} className="text-subtle h-4 w-4" />;}diff --git a/packages/features/routing-trace/presenters/RoutingFormTracePresenter.test.ts b/packages/features/routing-trace/presenters/RoutingFormTracePresenter.test.tsindex 1e8e55e938b..75b14bc7c7d 100644--- a/packages/features/routing-trace/presenters/RoutingFormTracePresenter.test.ts+++ b/packages/features/routing-trace/presenters/RoutingFormTracePresenter.test.ts@@ -66,16 +66,12 @@ describe("RoutingFormTracePresenter", () => {});it("presents route_matched without routeName", () => {- const result = RoutingFormTracePresenter.present(- makeStep("route_matched", { routeId: "route-1" })- );+ const result = RoutingFormTracePresenter.present(makeStep("route_matched", { routeId: "route-1" }));expect(result).toBe('Route matched: "Unnamed route" (ID: route-1)');});it("presents fallback_route_used without routeName", () => {- const result = RoutingFormTracePresenter.present(- makeStep("fallback_route_used", { routeId: "route-2" })- );+ const result = RoutingFormTracePresenter.present(makeStep("fallback_route_used", { routeId: "route-2" }));expect(result).toBe('Fallback route used: "Unnamed route" (ID: route-2)');});diff --git a/packages/features/routing-trace/presenters/RoutingFormTracePresenter.ts b/packages/features/routing-trace/presenters/RoutingFormTracePresenter.tsindex fd0e79e2568..ab80036ff27 100644--- a/packages/features/routing-trace/presenters/RoutingFormTracePresenter.ts+++ b/packages/features/routing-trace/presenters/RoutingFormTracePresenter.ts@@ -14,7 +14,9 @@ export class RoutingFormTracePresenter {parts.push(`Route: "${routeName}"`);if (d.routeIsFallback) parts.push("(fallback)");if (d.attributeRoutingDetails && Array.isArray(d.attributeRoutingDetails)) {- const details = (d.attributeRoutingDetails as Array<{ attributeName: string; attributeValue: string }>)+ const details = (+ d.attributeRoutingDetails as Array<{ attributeName: string; attributeValue: string }>+ ).map((a) => `${a.attributeName}=${a.attributeValue}`).join(", ");parts.push(`Attributes: [${details}]`);diff --git a/packages/features/routing-trace/presenters/RoutingTracePresenter.test.ts b/packages/features/routing-trace/presenters/RoutingTracePresenter.test.tsindex 7b021151e27..7297201ec78 100644--- a/packages/features/routing-trace/presenters/RoutingTracePresenter.test.ts+++ b/packages/features/routing-trace/presenters/RoutingTracePresenter.test.ts@@ -88,7 +88,9 @@ describe("RoutingTracePresenter", () => {expect(result).toHaveLength(3);expect(result[0].message).toBe('Route matched: "Sales" (ID: route-1)');- expect(result[1].message).toBe("GraphQL account resolution initiated for [email protected] (domain: acme.com)");+ expect(result[1].message).toBe(+ "GraphQL account resolution initiated for [email protected] (domain: acme.com)"+ );expect(result[2].message).toBe("Salesforce assignment: [email protected] via Contact (ID: 003ABC)");});diff --git a/packages/features/routing-trace/presenters/SalesforceRoutingTracePresenter.test.ts b/packages/features/routing-trace/presenters/SalesforceRoutingTracePresenter.test.tsindex 2b65b5b1e4f..df68eaee22a 100644--- a/packages/features/routing-trace/presenters/SalesforceRoutingTracePresenter.test.ts+++ b/packages/features/routing-trace/presenters/SalesforceRoutingTracePresenter.test.ts@@ -45,7 +45,11 @@ describe("SalesforceRoutingTracePresenter", () => {it("presents lookup_field_query with accountId", () => {const result = SalesforceRoutingTracePresenter.present(- makeStep("lookup_field_query", { fieldName: "Owner__c", salesforceObject: "Account", accountId: "001ABC" })+ makeStep("lookup_field_query", {+ fieldName: "Owner__c",+ salesforceObject: "Account",+ accountId: "001ABC",+ }));expect(result).toBe('Querying lookup field "Owner__c" on Account (Account: 001ABC)');});@@ -66,7 +70,11 @@ describe("SalesforceRoutingTracePresenter", () => {it("presents contact_owner_lookup", () => {const result = SalesforceRoutingTracePresenter.present(- makeStep("contact_owner_lookup", { contactId: "003ABC", ownerEmail: "[email protected]", ownerId: "005ABC" })+ makeStep("contact_owner_lookup", {+ contactId: "003ABC",+ ownerEmail: "[email protected]",+ ownerId: "005ABC",+ }));expect(result).toBe("Contact owner lookup: [email protected] (Contact: 003ABC)");});@@ -80,7 +88,11 @@ describe("SalesforceRoutingTracePresenter", () => {it("presents account_owner_lookup", () => {const result = SalesforceRoutingTracePresenter.present(- makeStep("account_owner_lookup", { accountId: "001ABC", ownerEmail: "[email protected]", ownerId: "005ABC" })+ makeStep("account_owner_lookup", {+ accountId: "001ABC",+ ownerEmail: "[email protected]",+ ownerId: "005ABC",+ }));expect(result).toBe("Account owner lookup: [email protected] (Account: 001ABC)");});@@ -128,7 +140,9 @@ describe("SalesforceRoutingTracePresenter", () => {ownerEmail: "[email protected]",}));- expect(result).toBe("Existing contact found via GraphQL: 003ABC (Account: 001ABC, Owner: [email protected])");+ expect(result).toBe(+ "Existing contact found via GraphQL: 003ABC (Account: 001ABC, Owner: [email protected])"+ );});it("presents graphql_account_found_by_website", () => {@@ -165,7 +179,11 @@ describe("SalesforceRoutingTracePresenter", () => {it("presents salesforce_assignment", () => {const result = SalesforceRoutingTracePresenter.present(- makeStep("salesforce_assignment", { email: "[email protected]", recordType: "Contact", recordId: "003ABC" })+ makeStep("salesforce_assignment", {+ email: "[email protected]",+ recordType: "Contact",+ recordId: "003ABC",+ }));expect(result).toBe("Salesforce assignment: [email protected] via Contact (ID: 003ABC)");});diff --git a/packages/features/routing-trace/repositories/PendingRoutingTraceRepository.interface.ts b/packages/features/routing-trace/repositories/PendingRoutingTraceRepository.interface.tsindex d4406a756d0..a7a9d5cc18d 100644--- a/packages/features/routing-trace/repositories/PendingRoutingTraceRepository.interface.ts+++ b/packages/features/routing-trace/repositories/PendingRoutingTraceRepository.interface.ts@@ -1,7 +1,4 @@-import type {- BaseRoutingTrace,- RoutingTrace,-} from "./RoutingTraceRepository.interface";+import type { BaseRoutingTrace, RoutingTrace } from "./RoutingTraceRepository.interface";export interface RoutingTraceWithQueuedResponse extends BaseRoutingTrace {queuedFormResponseId: string;@@ -20,10 +17,7 @@ export interface IPendingRoutingTraceRepository {findByFormResponseId(formResponseId: number): Promise<PendingRoutingTraceRecord | null>;findByQueuedFormResponseId(queuedFormResponseId: string): Promise<PendingRoutingTraceRecord | null>;/** Link a pending trace (created with queuedFormResponseId) to a formResponseId when the queued response is processed */- linkToFormResponse(args: {- queuedFormResponseId: string;- formResponseId: number;- }): Promise<void>;+ linkToFormResponse(args: { queuedFormResponseId: string; formResponseId: number }): Promise<void>;}interface BaseCreateArgs {@@ -38,6 +32,4 @@ interface CreateWithQueuedFormResponse extends BaseCreateArgs {queuedFormResponseId: string;}-export type IPendingRoutingTraceRepositoryCreateArgs =- | CreateWithFormResponse- | CreateWithQueuedFormResponse;+export type IPendingRoutingTraceRepositoryCreateArgs = CreateWithFormResponse | CreateWithQueuedFormResponse;diff --git a/packages/features/routing-trace/repositories/PrismaPendingRoutingTraceRepository.ts b/packages/features/routing-trace/repositories/PrismaPendingRoutingTraceRepository.tsindex d1850e0e3bc..84e857dfd25 100644--- a/packages/features/routing-trace/repositories/PrismaPendingRoutingTraceRepository.ts+++ b/packages/features/routing-trace/repositories/PrismaPendingRoutingTraceRepository.ts@@ -8,9 +8,7 @@ import type {PendingRoutingTraceRecord,} from "./PendingRoutingTraceRepository.interface";-export class PrismaPendingRoutingTraceRepository- implements IPendingRoutingTraceRepository-{+export class PrismaPendingRoutingTraceRepository implements IPendingRoutingTraceRepository {constructor(private readonly prisma: PrismaClient) {}async create(args: IPendingRoutingTraceRepositoryCreateArgs): Promise<void> {@@ -18,12 +16,8 @@ export class PrismaPendingRoutingTraceRepositorydata: {createdAt: new Date(),trace: args.trace as Prisma.InputJsonValue,- formResponseId:- "formResponseId" in args ? args.formResponseId : undefined,- queuedFormResponseId:- "queuedFormResponseId" in args- ? args.queuedFormResponseId- : undefined,+ formResponseId: "formResponseId" in args ? args.formResponseId : undefined,+ queuedFormResponseId: "queuedFormResponseId" in args ? args.queuedFormResponseId : undefined,},});}@@ -39,9 +33,7 @@ export class PrismaPendingRoutingTraceRepository};}- async findByQueuedFormResponseId(- queuedFormResponseId: string- ): Promise<PendingRoutingTraceRecord | null> {+ async findByQueuedFormResponseId(queuedFormResponseId: string): Promise<PendingRoutingTraceRecord | null> {const result = await this.prisma.pendingRoutingTrace.findUnique({where: { queuedFormResponseId },});@@ -52,10 +44,7 @@ export class PrismaPendingRoutingTraceRepository};}- async linkToFormResponse(args: {- queuedFormResponseId: string;- formResponseId: number;- }): Promise<void> {+ async linkToFormResponse(args: { queuedFormResponseId: string; formResponseId: number }): Promise<void> {await this.prisma.pendingRoutingTrace.update({where: { queuedFormResponseId: args.queuedFormResponseId },data: { formResponseId: args.formResponseId },diff --git a/packages/features/routing-trace/services/RoutingTraceService.test.ts b/packages/features/routing-trace/services/RoutingTraceService.test.tsindex 3f2b522feac..130439e3ae8 100644--- a/packages/features/routing-trace/services/RoutingTraceService.test.ts+++ b/packages/features/routing-trace/services/RoutingTraceService.test.ts@@ -29,7 +29,10 @@ describe("RoutingTraceService", () => {};}- function createMockAssignmentReasonRepository(): Pick<AssignmentReasonRepository, "createAssignmentReason"> {+ function createMockAssignmentReasonRepository(): Pick<+ AssignmentReasonRepository,+ "createAssignmentReason"+ > {return {createAssignmentReason: vi.fn(),};diff --git a/packages/features/routing-trace/services/RoutingTraceService.ts b/packages/features/routing-trace/services/RoutingTraceService.tsindex 4d5871a1bac..3d8d2ce9288 100644--- a/packages/features/routing-trace/services/RoutingTraceService.ts+++ b/packages/features/routing-trace/services/RoutingTraceService.ts@@ -62,22 +62,12 @@ export class RoutingTraceService {}/** To be called by the domain specific routing trace services */- addStep({- domain,- step,- data = {},- }: {- domain: string;- step: string;- data?: Record<string, unknown>;- }) {+ addStep({ domain, step, data = {} }: { domain: string; step: string; data?: Record<string, unknown> }) {this.routingTraceSteps.push({ domain, step, timestamp: Date.now(), data });}/** Save pending trace when routing form is submitted (before booking is created) */- async savePendingRoutingTrace(- args: { formResponseId: number } | { queuedFormResponseId: string }- ) {+ async savePendingRoutingTrace(args: { formResponseId: number } | { queuedFormResponseId: string }) {await this.deps.pendingRoutingTraceRepository.create({trace: this.routingTraceSteps,...args,@@ -97,28 +87,38 @@ export class RoutingTraceService {isRerouting: boolean;reroutedByEmail?: string | null;}): Promise<ProcessRoutingTraceResult | null> {- const { formResponseId, queuedFormResponseId, bookingId, bookingUid, organizerEmail, isRerouting, reroutedByEmail } = args;+ const {+ formResponseId,+ queuedFormResponseId,+ bookingId,+ bookingUid,+ organizerEmail,+ isRerouting,+ reroutedByEmail,+ } = args;let pendingTrace = null;if (formResponseId) {pendingTrace = await this.deps.pendingRoutingTraceRepository.findByFormResponseId(formResponseId);} else if (queuedFormResponseId) {- pendingTrace = await this.deps.pendingRoutingTraceRepository.findByQueuedFormResponseId(queuedFormResponseId);+ pendingTrace =+ await this.deps.pendingRoutingTraceRepository.findByQueuedFormResponseId(queuedFormResponseId);}if (!pendingTrace) {- logger.warn("Could not find pending routing trace for form response", { formResponseId, queuedFormResponseId, bookingId });+ logger.warn("Could not find pending routing trace for form response", {+ formResponseId,+ queuedFormResponseId,+ bookingId,+ });return null;}- const assignmentReasonData = this.extractAssignmentReasonFromTrace(- pendingTrace.trace,- {- organizerEmail,- isRerouting,- reroutedByEmail,- }- );+ const assignmentReasonData = this.extractAssignmentReasonFromTrace(pendingTrace.trace, {+ organizerEmail,+ isRerouting,+ reroutedByEmail,+ });let assignmentReasonId: number | undefined;@@ -169,24 +169,16 @@ export class RoutingTraceService {);if (crmAssignmentStep && crmAssignmentStep.data) {- const {- email,- recordType,- recordId,- rrSkipToAccountLookupField,- rrSKipToAccountLookupFieldName,- } = crmAssignmentStep.data as {- email?: string;- recordType?: string | null;- recordId?: string;- rrSkipToAccountLookupField?: boolean;- rrSKipToAccountLookupFieldName?: string | null;- };+ const { email, recordType, recordId, rrSkipToAccountLookupField, rrSKipToAccountLookupFieldName } =+ crmAssignmentStep.data as {+ email?: string;+ recordType?: string | null;+ recordId?: string;+ rrSkipToAccountLookupField?: boolean;+ rrSKipToAccountLookupFieldName?: string | null;+ };- if (- email &&- email.toLowerCase() === context.organizerEmail.toLowerCase()- ) {+ if (email && email.toLowerCase() === context.organizerEmail.toLowerCase()) {return {reasonEnum: AssignmentReasonEnum.SALESFORCE_ASSIGNMENT,reasonString: this.buildSalesforceReasonString({@@ -215,8 +207,8 @@ export class RoutingTraceService {const reasonEnum = context.isRerouting? AssignmentReasonEnum.REROUTED: routeIsFallback- ? AssignmentReasonEnum.ROUTING_FORM_ROUTING_FALLBACK- : AssignmentReasonEnum.ROUTING_FORM_ROUTING;+ ? AssignmentReasonEnum.ROUTING_FORM_ROUTING_FALLBACK+ : AssignmentReasonEnum.ROUTING_FORM_ROUTING;return {reasonEnum,@@ -260,13 +252,7 @@ export class RoutingTraceService {rrSkipToAccountLookupField?: boolean;rrSKipToAccountLookupFieldName?: string | null;}): string {- const {- email,- recordType,- recordId,- rrSkipToAccountLookupField,- rrSKipToAccountLookupFieldName,- } = data;+ const { email, recordType, recordId, rrSkipToAccountLookupField, rrSKipToAccountLookupFieldName } = data;if (rrSkipToAccountLookupField && rrSKipToAccountLookupFieldName) {return `Salesforce account lookup field: ${rrSKipToAccountLookupFieldName} - ${email}${@@ -275,8 +261,6 @@ export class RoutingTraceService {}const recordLabel = recordType.toLowerCase();- return `Salesforce ${recordLabel} owner: ${email}${- recordId ? ` (${recordType} ID: ${recordId})` : ""- }`;+ return `Salesforce ${recordLabel} owner: ${email}${recordId ? ` (${recordType} ID: ${recordId})` : ""}`;}}diff --git a/packages/features/schedules/components/ScheduleComponent.tsx b/packages/features/schedules/components/ScheduleComponent.tsxindex 5c4d7631b76..965f08dd647 100644--- a/packages/features/schedules/components/ScheduleComponent.tsx+++ b/packages/features/schedules/components/ScheduleComponent.tsx@@ -44,12 +44,7 @@ export type SelectInnerClassNames = {};export type FieldPathByValue<TFieldValues extends FieldValues, TValue> = {- [Key in FieldPath<TFieldValues>]: FieldPathValue<- TFieldValues,- Key- > extends TValue- ? Key- : never;+ [Key in FieldPath<TFieldValues>]: FieldPathValue<TFieldValues, Key> extends TValue ? Key : never;}[FieldPath<TFieldValues>];export const ScheduleDay = <TFieldValues extends FieldValues>({@@ -99,10 +94,9 @@ export const ScheduleDay = <TFieldValues extends FieldValues>({onCheckedChange={(isChecked) => {if (isChecked) {const previousDayRange = lastNonEmptyDayRangeRef.current;- const newValue =- (previousDayRange && previousDayRange.length > 0- ? previousDayRange- : [DEFAULT_DAY_RANGE]) as TFieldValues[typeof name];+ const newValue = (+ previousDayRange && previousDayRange.length > 0 ? previousDayRange : [DEFAULT_DAY_RANGE]+ ) as TFieldValues[typeof name];setValue(name, newValue);} else {@@ -188,7 +182,7 @@ const CopyButton = ({export const ScheduleComponent = <TFieldValues extends FieldValues,- TPath extends FieldPathByValue<TFieldValues, TimeRange[][]>+ TPath extends FieldPathByValue<TFieldValues, TimeRange[][]>,>({name,control,@@ -408,10 +402,7 @@ const TimeRangeField = ({);};-export function parseTimeString(- input: string,- timeFormat: number | null-): Date | null {+export function parseTimeString(input: string, timeFormat: number | null): Date | null {if (!input.trim()) return null;const formats = timeFormat === 12 ? ["h:mma", "HH:mm"] : ["HH:mm", "h:mma"];@@ -463,8 +454,7 @@ const LazySelect = ({if (actionMeta.action === "input-change" && newValue.trim()) {const trimmedValue = newValue.trim();- const formats =- userTimeFormat === 12 ? ["h:mma", "HH:mm"] : ["HH:mm", "h:mma"];+ const formats = userTimeFormat === 12 ? ["h:mma", "HH:mm"] : ["HH:mm", "h:mma"];const parsedTime = dayjs(trimmedValue, formats, true);const looksLikeTime = /^\d{1,2}:\d{2}(a|p|am|pm)?$/i.test(trimmedValue);@@ -492,10 +482,7 @@ const LazySelect = ({const filteredOptions = React.useMemo(() => {const dropdownOptions = options.filter((option) =>- defaultFilter(- { ...option, data: option.label, value: option.label },- inputValue- )+ defaultFilter({ ...option, data: option.label, value: option.label }, inputValue));const trimmedInput = inputValue.trim();@@ -505,15 +492,11 @@ const LazySelect = ({if (parsedTime) {const parsedDayjs = dayjs(parsedTime);// Validate against min/max bounds using same logic as filter function- const withinBounds =- (!min || parsedDayjs.isAfter(min)) &&- (!max || parsedDayjs.isBefore(max));+ const withinBounds = (!min || parsedDayjs.isAfter(min)) && (!max || parsedDayjs.isBefore(max));if (withinBounds) {const parsedTimestamp = parsedTime.valueOf();- const existsInOptions = options.some(- (option) => option.value === parsedTimestamp- );+ const existsInOptions = options.some((option) => option.value === parsedTimestamp);if (!existsInOptions) {const manualOption: IOption = {@@ -616,9 +599,7 @@ const useOptions = (timeFormat: number | null) => {({ offset, limit, current }: { offset?: ConfigType; limit?: ConfigType; current?: ConfigType }) => {if (current) {const currentValue = dayjs(current).toDate().valueOf();- const currentOption = options.find(- (option) => option.value === currentValue- );+ const currentOption = options.find((option) => option.value === currentValue);if (currentOption) {setFilteredOptions([currentOption]);} else {@@ -635,10 +616,7 @@ const useOptions = (timeFormat: number | null) => {setFilteredOptions(options.filter((option) => {const time = dayjs(option.value);- return (- (!limit || time.isBefore(limit)) &&- (!offset || time.isAfter(offset))- );+ return (!limit || time.isBefore(limit)) && (!offset || time.isAfter(offset));}));},diff --git a/packages/features/schedules/components/ScheduleListItem.tsx b/packages/features/schedules/components/ScheduleListItem.tsxindex a7d4e594020..9d3bf70ef1b 100644--- a/packages/features/schedules/components/ScheduleListItem.tsx+++ b/packages/features/schedules/components/ScheduleListItem.tsx@@ -66,47 +66,40 @@ export function ScheduleListItem({return (<li key={schedule.id}><div className="hover:bg-cal-muted flex items-center justify-between px-3 py-5 transition sm:px-4">- <Link href={redirectUrl} className="grow truncate text-sm" title={schedule.name}>- <div className="space-x-2 rtl:space-x-reverse">- <span className="text-emphasis truncate font-medium">{schedule.name}</span>- {schedule.isDefault && (- <Badge variant="gray" className="text-xs">- {t("default")}- </Badge>- )}- </div>- <p className="text-subtle mt-1">- {schedule.availability- .filter(- (availability: AvailabilityItem) => !!availability.days.length- )- .map((availability: AvailabilityItem) =>- availabilityAsString(availability, {- locale: i18n.language,- hour12: displayOptions?.hour12,- })- )- // sort the availability strings as per user's weekstart (settings)- .sort(- sortAvailabilityStrings(- i18n.language,- displayOptions?.weekStart- )- )- .map((availabilityString: string) => (- <Fragment key={availabilityString}>- {availabilityString}- <br />- </Fragment>- ))}- {(schedule.timeZone || displayOptions?.timeZone) && (- <span className="my-1 flex items-center first-letter:text-xs">- <Icon name="globe" className="h-3.5 w-3.5" />- {schedule.timeZone ?? displayOptions?.timeZone}- </span>- )}- </p>- </Link>+ <Link href={redirectUrl} className="grow truncate text-sm" title={schedule.name}>+ <div className="space-x-2 rtl:space-x-reverse">+ <span className="text-emphasis truncate font-medium">{schedule.name}</span>+ {schedule.isDefault && (+ <Badge variant="gray" className="text-xs">+ {t("default")}+ </Badge>+ )}+ </div>+ <p className="text-subtle mt-1">+ {schedule.availability+ .filter((availability: AvailabilityItem) => !!availability.days.length)+ .map((availability: AvailabilityItem) =>+ availabilityAsString(availability, {+ locale: i18n.language,+ hour12: displayOptions?.hour12,+ })+ )+ // sort the availability strings as per user's weekstart (settings)+ .sort(sortAvailabilityStrings(i18n.language, displayOptions?.weekStart))+ .map((availabilityString: string) => (+ <Fragment key={availabilityString}>+ {availabilityString}+ <br />+ </Fragment>+ ))}+ {(schedule.timeZone || displayOptions?.timeZone) && (+ <span className="my-1 flex items-center first-letter:text-xs">+ <Icon name="globe" className="h-3.5 w-3.5" />+ {schedule.timeZone ?? displayOptions?.timeZone}+ </span>+ )}+ </p>+ </Link><Dropdown><DropdownMenuTrigger asChild><Buttondiff --git a/packages/features/selectedCalendar/repositories/SelectedCalendarRepository.ts b/packages/features/selectedCalendar/repositories/SelectedCalendarRepository.tsindex bae4aed7dcd..182c35e6b23 100644--- a/packages/features/selectedCalendar/repositories/SelectedCalendarRepository.ts+++ b/packages/features/selectedCalendar/repositories/SelectedCalendarRepository.ts@@ -278,10 +278,7 @@ export class SelectedCalendarRepository implements ISelectedCalendarRepository {],},{- OR: [- { googleChannelExpiration: null },- { googleChannelExpiration: { lt: tomorrowTimestamp } },- ],+ OR: [{ googleChannelExpiration: null }, { googleChannelExpiration: { lt: tomorrowTimestamp } }],},],},diff --git a/packages/features/settings/appDir/SettingsHeader.tsx b/packages/features/settings/appDir/SettingsHeader.tsxindex 9d6944cfa70..17e59f3da35 100644--- a/packages/features/settings/appDir/SettingsHeader.tsx+++ b/packages/features/settings/appDir/SettingsHeader.tsx@@ -39,7 +39,7 @@ export default function Header({onBackButtonClick,}: HeaderProps) {const { t } = useLocale();-+return (<div><headerdiff --git a/packages/features/settings/appDir/SettingsHeaderWithBackButton.tsx b/packages/features/settings/appDir/SettingsHeaderWithBackButton.tsxindex fd35f900ccc..24b6829a74c 100644--- a/packages/features/settings/appDir/SettingsHeaderWithBackButton.tsx+++ b/packages/features/settings/appDir/SettingsHeaderWithBackButton.tsx@@ -17,7 +17,5 @@ type SettingsHeaderWithBackButtonProps = {export default function SettingsHeaderWithBackButton(props: SettingsHeaderWithBackButtonProps) {const router = useRouter();- return (- <SettingsHeader {...props} backButton={true} onBackButtonClick={() => router.back()} />- );+ return <SettingsHeader {...props} backButton={true} onBackButtonClick={() => router.back()} />;}diff --git a/packages/features/tasker/repository.ts b/packages/features/tasker/repository.tsindex 1a03803cbd5..4d52028b2a3 100644--- a/packages/features/tasker/repository.ts+++ b/packages/features/tasker/repository.ts@@ -42,7 +42,7 @@ type Dependencies = {};export class TaskRepository {- constructor(private readonly deps: Dependencies) { }+ constructor(private readonly deps: Dependencies) {}async create(type: TaskTypes,diff --git a/packages/features/tasker/tasks/bookingAudit.ts b/packages/features/tasker/tasks/bookingAudit.tsindex 04722ff8139..bd7a4ccc5f3 100644--- a/packages/features/tasker/tasks/bookingAudit.ts+++ b/packages/features/tasker/tasks/bookingAudit.ts@@ -7,38 +7,38 @@ const log = logger.getSubLogger({ prefix: ["[tasker] bookingAudit"] });/*** Booking Audit Task Handler- *+ ** Thin wrapper that parses JSON and delegates to BookingAuditTaskConsumer.* Routes to processAuditTask or processBulkAuditTask based on isBulk field.- *+ **/export async function bookingAudit(payload: string, taskId?: string): Promise<void> {- try {- if (!taskId) {- throw new Error("Task ID is required for booking audit consumer");- }- const parsedPayload: unknown = JSON.parse(payload);+ try {+ if (!taskId) {+ throw new Error("Task ID is required for booking audit consumer");+ }+ const parsedPayload: unknown = JSON.parse(payload);- const parseResult = BookingAuditTaskConsumerSchema.safeParse(parsedPayload);+ const parseResult = BookingAuditTaskConsumerSchema.safeParse(parsedPayload);- if (!parseResult.success) {- const errorMsg = `Invalid booking audit payload: ${safeStringify(parseResult.error.errors)} | TaskId: ${taskId}`;- log.error(errorMsg);- throw new Error(errorMsg);- }+ if (!parseResult.success) {+ const errorMsg = `Invalid booking audit payload: ${safeStringify(parseResult.error.errors)} | TaskId: ${taskId}`;+ log.error(errorMsg);+ throw new Error(errorMsg);+ }- const validatedPayload = parseResult.data;- const bookingAuditTaskConsumer = getBookingAuditTaskConsumer();+ const validatedPayload = parseResult.data;+ const bookingAuditTaskConsumer = getBookingAuditTaskConsumer();- if (validatedPayload.isBulk) {- await bookingAuditTaskConsumer.processBulkAuditTask(validatedPayload, taskId);- } else {- await bookingAuditTaskConsumer.processAuditTask(validatedPayload, taskId);- }- } catch (error) {- const errorMsg = `Error processing booking audit: ${safeStringify(error)} | TaskId: ${taskId}`;- log.error(errorMsg);- // Rethrow to trigger retry via Tasker- throw error;+ if (validatedPayload.isBulk) {+ await bookingAuditTaskConsumer.processBulkAuditTask(validatedPayload, taskId);+ } else {+ await bookingAuditTaskConsumer.processAuditTask(validatedPayload, taskId);}+ } catch (error) {+ const errorMsg = `Error processing booking audit: ${safeStringify(error)} | TaskId: ${taskId}`;+ log.error(errorMsg);+ // Rethrow to trigger retry via Tasker+ throw error;+ }}diff --git a/packages/features/tasker/tasks/crm/__tests__/createCRMEvent.test.ts b/packages/features/tasker/tasks/crm/__tests__/createCRMEvent.test.tsindex 59e639ce544..d20113fa25e 100644--- a/packages/features/tasker/tasks/crm/__tests__/createCRMEvent.test.ts+++ b/packages/features/tasker/tasks/crm/__tests__/createCRMEvent.test.ts@@ -406,10 +406,7 @@ describe("createCRMEvent", () => {.mockResolvedValueOnce(mockSalesforceCredential).mockResolvedValueOnce(mockHubspotCredential);- prismaMock.credential.findMany.mockResolvedValueOnce([- mockSalesforceCredential,- mockHubspotCredential,- ]);+ prismaMock.credential.findMany.mockResolvedValueOnce([mockSalesforceCredential, mockHubspotCredential]);prismaMock.bookingReference.findMany.mockResolvedValueOnce([]);diff --git a/packages/features/tasker/tasks/executeAIPhoneCall.ts b/packages/features/tasker/tasks/executeAIPhoneCall.tsindex 116cad43f7a..21cfbbb7cde 100644--- a/packages/features/tasker/tasks/executeAIPhoneCall.ts+++ b/packages/features/tasker/tasks/executeAIPhoneCall.ts@@ -176,8 +176,8 @@ export async function executeAIPhoneCall(payload: string) {const rateLimitIdentifier = data.teamId? `executeAIPhoneCall:team-${data.teamId}`: data.userId- ? `executeAIPhoneCall:user-${data.userId}`- : null;+ ? `executeAIPhoneCall:user-${data.userId}`+ : null;if (!rateLimitIdentifier) {log.warn(`No rate limit identifier found for AI phone call. This should not happen.`, {diff --git a/packages/features/tasker/tasks/scanWorkflowBody.ts b/packages/features/tasker/tasks/scanWorkflowBody.tsindex 56c323584ac..ab194bf3dcc 100644--- a/packages/features/tasker/tasks/scanWorkflowBody.ts+++ b/packages/features/tasker/tasks/scanWorkflowBody.ts@@ -27,7 +27,11 @@ const log = logger.getSubLogger({ prefix: ["[tasker] scanWorkflowBody"] });* Extracts the duplicated logic from both Iffy-enabled and Iffy-disabled paths.*/async function handleUrlScanningForStep(- workflowStep: { id: number; reminderBody: string | null; workflow: { user: { whitelistWorkflows: boolean } | null } },+ workflowStep: {+ id: number;+ reminderBody: string | null;+ workflow: { user: { whitelistWorkflows: boolean } | null };+ },userId: number): Promise<void> {if (URL_SCANNING_ENABLED && workflowStep.reminderBody) {diff --git a/packages/features/tasker/tasks/sendWorkflowEmails.test.ts b/packages/features/tasker/tasks/sendWorkflowEmails.test.tsindex ed1f939587c..7cea1128395 100644--- a/packages/features/tasker/tasks/sendWorkflowEmails.test.ts+++ b/packages/features/tasker/tasks/sendWorkflowEmails.test.ts@@ -6,9 +6,11 @@ vi.mock("@calcom/emails/workflow-email-service", () => ({const mockGetBookingForCalEventBuilderFromUid = vi.fn();vi.mock("@calcom/features/bookings/repositories/BookingRepository", () => ({- BookingRepository: vi.fn().mockImplementation(function() { return {- getBookingForCalEventBuilderFromUid: mockGetBookingForCalEventBuilderFromUid,- }; }),+ BookingRepository: vi.fn().mockImplementation(function () {+ return {+ getBookingForCalEventBuilderFromUid: mockGetBookingForCalEventBuilderFromUid,+ };+ }),}));vi.mock("@calcom/features/bookings/repositories/BookingSeatRepository", () => ({@@ -17,9 +19,11 @@ vi.mock("@calcom/features/bookings/repositories/BookingSeatRepository", () => ({const mockHandleSendEmailWorkflowTask = vi.fn();vi.mock("@calcom/features/ee/workflows/lib/service/EmailWorkflowService", () => ({- EmailWorkflowService: vi.fn().mockImplementation(function() { return {- handleSendEmailWorkflowTask: mockHandleSendEmailWorkflowTask,- }; }),+ EmailWorkflowService: vi.fn().mockImplementation(function () {+ return {+ handleSendEmailWorkflowTask: mockHandleSendEmailWorkflowTask,+ };+ }),}));vi.mock("@calcom/features/ee/workflows/repositories/WorkflowReminderRepository", () => ({diff --git a/packages/features/tasker/tasks/sendWorkflowEmails.ts b/packages/features/tasker/tasks/sendWorkflowEmails.tsindex fec3d7158d2..1a0a516e60b 100644--- a/packages/features/tasker/tasks/sendWorkflowEmails.ts+++ b/packages/features/tasker/tasks/sendWorkflowEmails.ts@@ -51,9 +51,11 @@ export async function sendWorkflowEmails(payload: string): Promise<void> {const bookingMetadata = bookingMetadataSchema.parse(booking.metadata || {});- const calendarEvent = (await CalendarEventBuilder.fromBooking(booking, {- platformClientId: bookingMetadata?.platformClientId,- })).build();+ const calendarEvent = (+ await CalendarEventBuilder.fromBooking(booking, {+ platformClientId: bookingMetadata?.platformClientId,+ })+ ).build();if (!calendarEvent) {throw new Error("Calendar event could not be built");@@ -61,10 +63,10 @@ export async function sendWorkflowEmails(payload: string): Promise<void> {// Check if videoCallUrl exists in booking metadata and add it to evt.metadataconst metadata = bookingMetadata?.videoCallUrl- ? {- videoCallUrl: bookingMetadata.videoCallUrl,- }- : undefined;+ ? {+ videoCallUrl: bookingMetadata.videoCallUrl,+ }+ : undefined;const evtWithMetadata = { ...calendarEvent, metadata };diff --git a/packages/features/tasker/tasks/test/scanWorkflowBody.test.ts b/packages/features/tasker/tasks/test/scanWorkflowBody.test.tsindex 3e144326248..295544434e8 100644--- a/packages/features/tasker/tasks/test/scanWorkflowBody.test.ts+++ b/packages/features/tasker/tasks/test/scanWorkflowBody.test.ts@@ -368,7 +368,7 @@ describe("scanWorkflowBody", () => {// Note: In practice, this scenario is rare since workflow steps are always// associated with a workflow, but the code handles it gracefully by logging// a warning and returning early.-+const payload = JSON.stringify({userId: 5,workflowStepIds: [999], // Non-existent step IDs@@ -376,7 +376,7 @@ describe("scanWorkflowBody", () => {// Should not throw - the function returns early when no steps are foundawait expect(scanWorkflowBody(payload)).resolves.not.toThrow();-+// Should not schedule notifications since no workflow was foundexpect(scheduleWorkflowNotifications).not.toHaveBeenCalled();});@@ -439,12 +439,7 @@ describe("scanWorkflowBody", () => {await scanWorkflowBody(payload);// Should pass whitelistWorkflows=true- expect(submitWorkflowStepForUrlScanning).toHaveBeenCalledWith(- 205,- expect.any(String),- 6,- true- );+ expect(submitWorkflowStepForUrlScanning).toHaveBeenCalledWith(205, expect.any(String), 6, true);});});diff --git a/packages/features/tasker/tasks/test/scanWorkflowUrls.test.ts b/packages/features/tasker/tasks/test/scanWorkflowUrls.test.tsindex 2bdf6d3d315..113573fe276 100644--- a/packages/features/tasker/tasks/test/scanWorkflowUrls.test.ts+++ b/packages/features/tasker/tasks/test/scanWorkflowUrls.test.ts@@ -338,12 +338,7 @@ describe("scanWorkflowUrls", () => {vi.mocked(urlScanner.isUrlScanningEnabled).mockReturnValue(true);vi.mocked(urlScanner.extractUrlsFromHtml).mockReturnValue(["https://example.com"]);- await submitWorkflowStepForUrlScanning(- 100,- '<a href="https://example.com">Link</a>',- 1,- false- );+ await submitWorkflowStepForUrlScanning(100, '<a href="https://example.com">Link</a>', 1, false);expect(tasker.create).toHaveBeenCalledWith("scanWorkflowUrls",@@ -360,12 +355,7 @@ describe("scanWorkflowUrls", () => {vi.mocked(urlScanner.isUrlScanningEnabled).mockReturnValue(true);vi.mocked(urlScanner.extractUrlsFromHtml).mockReturnValue(["https://example.com"]);- await submitWorkflowStepForUrlScanning(- 100,- '<a href="https://example.com">Link</a>',- 1,- true- );+ await submitWorkflowStepForUrlScanning(100, '<a href="https://example.com">Link</a>', 1, true);expect(tasker.create).toHaveBeenCalledWith("scanWorkflowUrls",@@ -391,12 +381,7 @@ describe("scanWorkflowUrls", () => {},});- await submitWorkflowStepForUrlScanning(- 104,- '<a href="https://example.com">Link</a>',- 1,- false- );+ await submitWorkflowStepForUrlScanning(104, '<a href="https://example.com">Link</a>', 1, false);// Should mark workflow step as verifiedconst workflowStep = await prismock.workflowStep.findUnique({diff --git a/packages/features/tasker/tasks/triggerFormSubmittedNoEvent/triggerFormSubmittedNoEventWebhook.ts b/packages/features/tasker/tasks/triggerFormSubmittedNoEvent/triggerFormSubmittedNoEventWebhook.tsindex 67e4c065109..8fc88616fbd 100644--- a/packages/features/tasker/tasks/triggerFormSubmittedNoEvent/triggerFormSubmittedNoEventWebhook.ts+++ b/packages/features/tasker/tasks/triggerFormSubmittedNoEvent/triggerFormSubmittedNoEventWebhook.ts@@ -2,7 +2,10 @@ import { z } from "zod";import type { FORM_SUBMITTED_WEBHOOK_RESPONSES } from "@calcom/app-store/routing-forms/lib/formSubmissionUtils";import incompleteBookingActionFunctions from "@calcom/app-store/routing-forms/lib/incompleteBooking/actionFunctions";-import { DEFAULT_WEBHOOK_VERSION, WebhookVersion } from "@calcom/features/webhooks/lib/interface/IWebhookRepository";+import {+ DEFAULT_WEBHOOK_VERSION,+ WebhookVersion,+} from "@calcom/features/webhooks/lib/interface/IWebhookRepository";import { sendGenericWebhookPayload } from "@calcom/features/webhooks/lib/sendPayload";import prisma from "@calcom/prisma";diff --git a/packages/features/tasker/tasks/triggerNoShow/triggerGuestNoShow.test.ts b/packages/features/tasker/tasks/triggerNoShow/triggerGuestNoShow.test.tsindex a3e801c1a53..81f226d6db5 100644--- a/packages/features/tasker/tasks/triggerNoShow/triggerGuestNoShow.test.ts+++ b/packages/features/tasker/tasks/triggerNoShow/triggerGuestNoShow.test.ts@@ -243,9 +243,7 @@ describe("Trigger Guest No Show:", () => {actor: { identifiedBy: "id", id: "00000000-0000-0000-0000-000000000000" },organizationId: null,auditData: {- attendeesNoShow: [- { attendeeEmail: "[email protected]", noShow: { new: true, old: false } },- ],+ attendeesNoShow: [{ attendeeEmail: "[email protected]", noShow: { new: true, old: false } }],},isBookingAuditEnabled: false,});@@ -446,9 +444,7 @@ describe("Trigger Guest No Show:", () => {actor: { identifiedBy: "id", id: "00000000-0000-0000-0000-000000000000" },organizationId: null,auditData: {- attendeesNoShow: [- { attendeeEmail: "[email protected]", noShow: { new: true, old: false } },- ],+ attendeesNoShow: [{ attendeeEmail: "[email protected]", noShow: { new: true, old: false } }],},isBookingAuditEnabled: false,});@@ -688,9 +684,7 @@ describe("Trigger Guest No Show:", () => {actor: { identifiedBy: "id", id: "00000000-0000-0000-0000-000000000000" },organizationId: null,auditData: {- attendeesNoShow: [- { attendeeEmail: "[email protected]", noShow: { new: true, old: false } },- ],+ attendeesNoShow: [{ attendeeEmail: "[email protected]", noShow: { new: true, old: false } }],},isBookingAuditEnabled: false,});diff --git a/packages/features/troubleshooter/components/CalendarToggleContainerComponent.tsx b/packages/features/troubleshooter/components/CalendarToggleContainerComponent.tsxindex 532e9b5df16..c16f6ec39f6 100644--- a/packages/features/troubleshooter/components/CalendarToggleContainerComponent.tsx+++ b/packages/features/troubleshooter/components/CalendarToggleContainerComponent.tsx@@ -37,18 +37,10 @@ function CalendarToggleItem(props: CalendarToggleItemProps) {{badgeText}</Badge></div>- }- >+ }><div className="[&>*]:text-emphasis flex flex-col gap-3">{props.calendars?.map((calendar) => {- return (- <Switch- key={calendar.name}- checked={calendar.active}- label={calendar.name}- disabled- />- );+ return <Switch key={calendar.name} checked={calendar.active} label={calendar.name} disabled />;})}</div></TroubleshooterListItemContainer>@@ -77,15 +69,10 @@ function EmptyCalendarToggleItem({{t("unavailable")}</Badge></div>- }- >+ }>{installCalendarAction && (<div className="flex flex-col gap-3">- <Button- color="secondary"- className="justify-center gap-2"- {...installCalendarAction}- >+ <Button color="secondary" className="justify-center gap-2" {...installCalendarAction}>{t("install_calendar")}</Button></div>@@ -127,15 +114,11 @@ export function CalendarToggleContainerComponent({return (<div className="flex flex-col stack-y-3">- <p className="text-sm font-medium leading-none">- {t("calendars_were_checking_for_conflicts")}- </p>+ <p className="text-sm font-medium leading-none">{t("calendars_were_checking_for_conflicts")}</p>{hasConnectedCalendars && !isLoading ? (<>{connectedCalendars.map((calendar) => {- const foundPrimary = calendar.calendars?.find(- (item) => item.primary- );+ const foundPrimary = calendar.calendars?.find((item) => item.primary);// Will be used when getAvailbility is modified to use externalId instead of appId for source.// const color = SELECTION_COLORS[idx] || "#000000";// // Add calendar to color map using externalId (what we use on the backend to determine source)@@ -157,11 +140,7 @@ export function CalendarToggleContainerComponent({);})}{manageCalendarsAction && (- <Button- color="secondary"- className="justify-center gap-2"- {...manageCalendarsAction}- >+ <Button color="secondary" className="justify-center gap-2" {...manageCalendarsAction}>{t("manage_calendars")}</Button>)}diff --git a/packages/features/troubleshooter/components/EventTypeSelectComponent.tsx b/packages/features/troubleshooter/components/EventTypeSelectComponent.tsxindex b4e04842561..aa0b9c41c83 100644--- a/packages/features/troubleshooter/components/EventTypeSelectComponent.tsx+++ b/packages/features/troubleshooter/components/EventTypeSelectComponent.tsx@@ -27,14 +27,13 @@ export function EventTypeSelectComponent({isPending,}: EventTypeSelectComponentProps): JSX.Element {const { t } = useLocale();- const { event: selectedEventType, setEvent: setSelectedEventType } =- useTroubleshooterStore(- (state) => ({- event: state.event,- setEvent: state.setEvent,- }),- shallow- );+ const { event: selectedEventType, setEvent: setSelectedEventType } = useTroubleshooterStore(+ (state) => ({+ event: state.event,+ setEvent: state.setEvent,+ }),+ shallow+ );const options = useMemo(() => {if (!eventTypes) return [];@@ -51,9 +50,7 @@ export function EventTypeSelectComponent({if (!eventTypes || eventTypes.length === 0) return;const selectedEventIdParam = getQueryParam("eventTypeId");- const eventTypeId = selectedEventIdParam- ? parseInt(selectedEventIdParam, 10)- : null;+ const eventTypeId = selectedEventIdParam ? parseInt(selectedEventIdParam, 10) : null;// If we already have a selected event that matches the query param, don't do anythingif (selectedEventType?.id === eventTypeId) return;@@ -93,10 +90,7 @@ export function EventTypeSelectComponent({label={t("event_type")}options={options}isDisabled={isPending || options.length === 0}- value={- options.find((option) => option.id === selectedEventType?.id) ||- options[0]- }+ value={options.find((option) => option.id === selectedEventType?.id) || options[0]}onChange={(option) => {if (!option) return;const foundEventType = eventTypes?.find((et) => et.id === option.id);diff --git a/packages/features/users/lib/getRoutedUsers.ts b/packages/features/users/lib/getRoutedUsers.tsindex edf4e5a19a8..db30dbe0019 100644--- a/packages/features/users/lib/getRoutedUsers.ts+++ b/packages/features/users/lib/getRoutedUsers.ts@@ -12,7 +12,7 @@ import type { CredentialPayload } from "@calcom/types/Credential";const log = logger.getSubLogger({ prefix: ["[getRoutedUsers]"] });export const getRoutedUsersWithContactOwnerAndFixedUsers = <- T extends { id: number; isFixed?: boolean; email: string }+ T extends { id: number; isFixed?: boolean; email: string },>({routedTeamMemberIds,users,@@ -130,7 +130,7 @@ export function getNormalizedHosts<User extends BaseUser, Host extends BaseHost<type BaseUserWithCredentialPayload = BaseUser & { credentials: CredentialPayload[] };export async function getNormalizedHostsWithDelegationCredentials<User extends BaseUserWithCredentialPayload,- Host extends BaseHost<User>+ Host extends BaseHost<User>,>({eventType,}: {diff --git a/packages/features/users/repositories/UserRepository.test.ts b/packages/features/users/repositories/UserRepository.test.tsindex 8b281341269..ac50054c356 100644--- a/packages/features/users/repositories/UserRepository.test.ts+++ b/packages/features/users/repositories/UserRepository.test.ts@@ -1,4 +1,3 @@-import prismock from "@calcom/testing/lib/__mocks__/prisma";import { describe, test, vi, expect, beforeEach } from "vitest";diff --git a/packages/features/watchlist/lib/errors/WatchlistErrors.ts b/packages/features/watchlist/lib/errors/WatchlistErrors.tsindex 7c1220e4849..1987c6d9b42 100644--- a/packages/features/watchlist/lib/errors/WatchlistErrors.ts+++ b/packages/features/watchlist/lib/errors/WatchlistErrors.ts@@ -35,14 +35,11 @@ export const WatchlistErrors = {invalidIp: (message: string) => new WatchlistError(WatchlistErrorCode.INVALID_IP, message),- validationError: (message: string) =>- new WatchlistError(WatchlistErrorCode.VALIDATION_ERROR, message),+ validationError: (message: string) => new WatchlistError(WatchlistErrorCode.VALIDATION_ERROR, message),- permissionDenied: (message: string) =>- new WatchlistError(WatchlistErrorCode.PERMISSION_DENIED, message),+ permissionDenied: (message: string) => new WatchlistError(WatchlistErrorCode.PERMISSION_DENIED, message),- duplicateEntry: (message: string) =>- new WatchlistError(WatchlistErrorCode.DUPLICATE_ENTRY, message),+ duplicateEntry: (message: string) => new WatchlistError(WatchlistErrorCode.DUPLICATE_ENTRY, message),bulkDeletePartialFailure: (message: string) =>new WatchlistError(WatchlistErrorCode.BULK_DELETE_PARTIAL_FAILURE, message),diff --git a/packages/features/watchlist/lib/repository/WatchlistRepository.ts b/packages/features/watchlist/lib/repository/WatchlistRepository.tsindex 8d0aebe30e7..caff46857e5 100644--- a/packages/features/watchlist/lib/repository/WatchlistRepository.ts+++ b/packages/features/watchlist/lib/repository/WatchlistRepository.ts@@ -212,10 +212,7 @@ export class WatchlistRepository implements IWatchlistRepository {},});- const allBookingReports = [- ...(entry?.bookingReports ?? []),- ...(entry?.globalBookingReports ?? []),- ];+ const allBookingReports = [...(entry?.bookingReports ?? []), ...(entry?.globalBookingReports ?? [])];return {entry: entrydiff --git a/packages/features/watchlist/lib/service/OrganizationWatchlistOperationsService.ts b/packages/features/watchlist/lib/service/OrganizationWatchlistOperationsService.tsindex 3a980705a0e..f8765b9a3ad 100644--- a/packages/features/watchlist/lib/service/OrganizationWatchlistOperationsService.ts+++ b/packages/features/watchlist/lib/service/OrganizationWatchlistOperationsService.ts@@ -117,7 +117,10 @@ export class OrganizationWatchlistOperationsService extends WatchlistOperationsS};}- async dismissReportByEmail(input: { email: string; userId: number }): Promise<{ success: boolean; count: number }> {+ async dismissReportByEmail(input: {+ email: string;+ userId: number;+ }): Promise<{ success: boolean; count: number }> {await this.checkPermission(input.userId, "watchlist.update");const normalizedEmail = normalizeEmail(input.email);diff --git a/packages/features/watchlist/operations/check-user-blocking.test.ts b/packages/features/watchlist/operations/check-user-blocking.test.tsindex 5f1aa4a04ee..6c4293834ce 100644--- a/packages/features/watchlist/operations/check-user-blocking.test.ts+++ b/packages/features/watchlist/operations/check-user-blocking.test.ts@@ -8,7 +8,6 @@ import {type BlockingInfo,} from "./check-user-blocking";-vi.mock("@calcom/features/di/watchlist/containers/watchlist", () => ({getWatchlistFeature: vi.fn(),}));@@ -55,7 +54,9 @@ describe("check-user-blocking", () => {});test("should skip users with empty emails", async () => {- mockGlobalBlocking.areBlocked.mockResolvedValue(new Map([["[email protected]", { isBlocked: false }]]));+ mockGlobalBlocking.areBlocked.mockResolvedValue(+ new Map([["[email protected]", { isBlocked: false }]])+ );const users: BlockableUser[] = [{ email: "", locked: false },@@ -290,9 +291,7 @@ describe("check-user-blocking", () => {});test("should return false for non-blocked user", () => {- const blockingMap = new Map<string, BlockingInfo>([- ["[email protected]", { isBlocked: false }],- ]);+ const blockingMap = new Map<string, BlockingInfo>([["[email protected]", { isBlocked: false }]]);expect(isUserBlocked("[email protected]", blockingMap)).toBe(false);});@@ -343,9 +342,7 @@ describe("check-user-blocking", () => {test("should combine global and org blocking results", async () => {const emails = ["[email protected]"];- mockGlobalBlocking.areBlocked.mockResolvedValue(- new Map([["[email protected]", { isBlocked: false }]])- );+ mockGlobalBlocking.areBlocked.mockResolvedValue(new Map([["[email protected]", { isBlocked: false }]]));mockOrgBlocking.areBlocked.mockResolvedValue(new Map([["[email protected]", { isBlocked: true }]]));const result = await checkWatchlistBlocking(emails, 123);@@ -381,9 +378,7 @@ describe("check-user-blocking", () => {test("should normalize emails in result map", async () => {const emails = ["[email protected]"];- mockGlobalBlocking.areBlocked.mockResolvedValue(- new Map([["[email protected]", { isBlocked: true }]])- );+ mockGlobalBlocking.areBlocked.mockResolvedValue(new Map([["[email protected]", { isBlocked: true }]]));const result = await checkWatchlistBlocking(emails);@@ -391,4 +386,3 @@ describe("check-user-blocking", () => {});});});-diff --git a/packages/features/watchlist/operations/filter-blocked-hosts.controller.test.ts b/packages/features/watchlist/operations/filter-blocked-hosts.controller.test.tsindex 555bcf9f6e4..3c45d966899 100644--- a/packages/features/watchlist/operations/filter-blocked-hosts.controller.test.ts+++ b/packages/features/watchlist/operations/filter-blocked-hosts.controller.test.ts@@ -2,7 +2,6 @@ import { describe, test, expect, vi, beforeEach } from "vitest";import { filterBlockedHosts, type HostWithEmail } from "./filter-blocked-hosts.controller";-vi.mock("@calcom/features/di/watchlist/containers/watchlist", () => ({getWatchlistFeature: vi.fn(),}));@@ -52,10 +51,7 @@ describe("filterBlockedHosts", () => {describe("Locked host filtering", () => {test("should filter out locked hosts", async () => {- const hosts = [- createHost(1, "[email protected]", true),- createHost(2, "[email protected]", false),- ];+ const hosts = [createHost(1, "[email protected]", true), createHost(2, "[email protected]", false)];mockGlobalBlocking.areBlocked.mockResolvedValue(new Map([["[email protected]", { isBlocked: false }]])@@ -69,10 +65,7 @@ describe("filterBlockedHosts", () => {});test("should filter out all locked hosts", async () => {- const hosts = [- createHost(1, "[email protected]", true),- createHost(2, "[email protected]", true),- ];+ const hosts = [createHost(1, "[email protected]", true), createHost(2, "[email protected]", true)];const result = await filterBlockedHosts(hosts);@@ -84,10 +77,7 @@ describe("filterBlockedHosts", () => {describe("Watchlist blocking", () => {test("should filter out watchlist-blocked hosts", async () => {- const hosts = [- createHost(1, "[email protected]", false),- createHost(2, "[email protected]", false),- ];+ const hosts = [createHost(1, "[email protected]", false), createHost(2, "[email protected]", false)];mockGlobalBlocking.areBlocked.mockResolvedValue(new Map([@@ -106,9 +96,7 @@ describe("filterBlockedHosts", () => {test("should check org-level blocking when organizationId provided", async () => {const hosts = [createHost(1, "[email protected]", false)];- mockGlobalBlocking.areBlocked.mockResolvedValue(- new Map([["[email protected]", { isBlocked: false }]])- );+ mockGlobalBlocking.areBlocked.mockResolvedValue(new Map([["[email protected]", { isBlocked: false }]]));mockOrgBlocking.areBlocked.mockResolvedValue(new Map([["[email protected]", { isBlocked: true }]]));const result = await filterBlockedHosts(hosts, 123);@@ -157,9 +145,7 @@ describe("filterBlockedHosts", () => {},];- mockGlobalBlocking.areBlocked.mockResolvedValue(- new Map([["[email protected]", { isBlocked: false }]])- );+ mockGlobalBlocking.areBlocked.mockResolvedValue(new Map([["[email protected]", { isBlocked: false }]]));const result = await filterBlockedHosts(hosts);@@ -176,9 +162,7 @@ describe("filterBlockedHosts", () => {test("should handle emails with different cases", async () => {const hosts = [createHost(1, "[email protected]", false)];- mockGlobalBlocking.areBlocked.mockResolvedValue(- new Map([["[email protected]", { isBlocked: true }]])- );+ mockGlobalBlocking.areBlocked.mockResolvedValue(new Map([["[email protected]", { isBlocked: true }]]));const result = await filterBlockedHosts(hosts);@@ -215,10 +199,7 @@ describe("filterBlockedHosts", () => {});test("should not call watchlist for locked-only hosts", async () => {- const hosts = [- createHost(1, "[email protected]", true),- createHost(2, "[email protected]", true),- ];+ const hosts = [createHost(1, "[email protected]", true), createHost(2, "[email protected]", true)];await filterBlockedHosts(hosts);@@ -226,4 +207,3 @@ describe("filterBlockedHosts", () => {});});});-diff --git a/packages/features/watchlist/operations/filter-blocked-users.controller.test.ts b/packages/features/watchlist/operations/filter-blocked-users.controller.test.tsindex 987f3fdb140..17dc19c1761 100644--- a/packages/features/watchlist/operations/filter-blocked-users.controller.test.ts+++ b/packages/features/watchlist/operations/filter-blocked-users.controller.test.ts@@ -4,7 +4,6 @@ import type { SpanFn } from "@calcom/features/watchlist/lib/telemetry";import { filterBlockedUsers, type UserWithEmail } from "./filter-blocked-users.controller";-vi.mock("@calcom/features/di/watchlist/containers/watchlist", () => ({getWatchlistFeature: vi.fn(),}));@@ -57,10 +56,7 @@ describe("filterBlockedUsers", () => {describe("Locked user filtering", () => {test("should filter out locked users", async () => {- const users = [- createUser("[email protected]", true, 1),- createUser("[email protected]", false, 2),- ];+ const users = [createUser("[email protected]", true, 1), createUser("[email protected]", false, 2)];mockGlobalBlocking.areBlocked.mockResolvedValue(new Map([["[email protected]", { isBlocked: false }]])@@ -74,10 +70,7 @@ describe("filterBlockedUsers", () => {});test("should filter out all locked users", async () => {- const users = [- createUser("[email protected]", true, 1),- createUser("[email protected]", true, 2),- ];+ const users = [createUser("[email protected]", true, 1), createUser("[email protected]", true, 2)];const result = await filterBlockedUsers(users);@@ -109,10 +102,7 @@ describe("filterBlockedUsers", () => {describe("Watchlist blocking", () => {test("should filter out watchlist-blocked users", async () => {- const users = [- createUser("[email protected]", false, 1),- createUser("[email protected]", false, 2),- ];+ const users = [createUser("[email protected]", false, 1), createUser("[email protected]", false, 2)];mockGlobalBlocking.areBlocked.mockResolvedValue(new Map([@@ -131,9 +121,7 @@ describe("filterBlockedUsers", () => {test("should check org-level blocking when organizationId provided", async () => {const users = [createUser("[email protected]", false, 1)];- mockGlobalBlocking.areBlocked.mockResolvedValue(- new Map([["[email protected]", { isBlocked: false }]])- );+ mockGlobalBlocking.areBlocked.mockResolvedValue(new Map([["[email protected]", { isBlocked: false }]]));mockOrgBlocking.areBlocked.mockResolvedValue(new Map([["[email protected]", { isBlocked: true }]]));const result = await filterBlockedUsers(users, 123);@@ -146,9 +134,7 @@ describe("filterBlockedUsers", () => {test("should not check org-level blocking when organizationId is null", async () => {const users = [createUser("[email protected]", false, 1)];- mockGlobalBlocking.areBlocked.mockResolvedValue(- new Map([["[email protected]", { isBlocked: false }]])- );+ mockGlobalBlocking.areBlocked.mockResolvedValue(new Map([["[email protected]", { isBlocked: false }]]));await filterBlockedUsers(users, null);@@ -231,9 +217,7 @@ describe("filterBlockedUsers", () => {},];- mockGlobalBlocking.areBlocked.mockResolvedValue(- new Map([["[email protected]", { isBlocked: false }]])- );+ mockGlobalBlocking.areBlocked.mockResolvedValue(new Map([["[email protected]", { isBlocked: false }]]));const result = await filterBlockedUsers(users);@@ -258,9 +242,7 @@ describe("filterBlockedUsers", () => {},];- mockGlobalBlocking.areBlocked.mockResolvedValue(- new Map([["[email protected]", { isBlocked: false }]])- );+ mockGlobalBlocking.areBlocked.mockResolvedValue(new Map([["[email protected]", { isBlocked: false }]]));const result = await filterBlockedUsers(users);@@ -273,9 +255,7 @@ describe("filterBlockedUsers", () => {test("should handle emails with different cases", async () => {const users = [createUser("[email protected]", false, 1)];- mockGlobalBlocking.areBlocked.mockResolvedValue(- new Map([["[email protected]", { isBlocked: true }]])- );+ mockGlobalBlocking.areBlocked.mockResolvedValue(new Map([["[email protected]", { isBlocked: true }]]));const result = await filterBlockedUsers(users);@@ -286,9 +266,7 @@ describe("filterBlockedUsers", () => {test("should handle emails with whitespace", async () => {const users = [createUser(" [email protected] ", false, 1)];- mockGlobalBlocking.areBlocked.mockResolvedValue(- new Map([["[email protected]", { isBlocked: false }]])- );+ mockGlobalBlocking.areBlocked.mockResolvedValue(new Map([["[email protected]", { isBlocked: false }]]));const result = await filterBlockedUsers(users);@@ -324,10 +302,7 @@ describe("filterBlockedUsers", () => {});test("should not call watchlist for locked-only users", async () => {- const users = [- createUser("[email protected]", true, 1),- createUser("[email protected]", true, 2),- ];+ const users = [createUser("[email protected]", true, 1), createUser("[email protected]", true, 2)];await filterBlockedUsers(users);@@ -339,9 +314,7 @@ describe("filterBlockedUsers", () => {test("should call span when provided", async () => {const users = [createUser("[email protected]", false, 1)];- mockGlobalBlocking.areBlocked.mockResolvedValue(- new Map([["[email protected]", { isBlocked: false }]])- );+ mockGlobalBlocking.areBlocked.mockResolvedValue(new Map([["[email protected]", { isBlocked: false }]]));const mockSpan: SpanFn = vi.fn((_options, callback) => {return Promise.resolve(callback());@@ -356,9 +329,7 @@ describe("filterBlockedUsers", () => {test("should work without span", async () => {const users = [createUser("[email protected]", false, 1)];- mockGlobalBlocking.areBlocked.mockResolvedValue(- new Map([["[email protected]", { isBlocked: false }]])- );+ mockGlobalBlocking.areBlocked.mockResolvedValue(new Map([["[email protected]", { isBlocked: false }]]));// Should not throw when span is not providedconst result = await filterBlockedUsers(users);@@ -367,4 +338,3 @@ describe("filterBlockedUsers", () => {});});});-diff --git a/packages/features/webhooks/lib/WebhookService.ts b/packages/features/webhooks/lib/WebhookService.tsindex 24d98fa84f2..6779d085318 100644--- a/packages/features/webhooks/lib/WebhookService.ts+++ b/packages/features/webhooks/lib/WebhookService.ts@@ -10,7 +10,10 @@ const log = logger.getSubLogger({ prefix: ["[WebhookService] "] });/** This is a WIP. With minimal methods until the API matures and stabilizes */export class WebhookService {- private constructor(private options: GetSubscriberOptions, private webhooks: WebhookSubscriber[]) {}+ private constructor(+ private options: GetSubscriberOptions,+ private webhooks: WebhookSubscriber[]+ ) {}static async init(options: GetSubscriberOptions) {const webhooks = await getWebhooks(options);return new WebhookService(options, webhooks);diff --git a/packages/features/webhooks/lib/factory/base/BaseDelegationPayloadBuilder.ts b/packages/features/webhooks/lib/factory/base/BaseDelegationPayloadBuilder.tsindex 8476b0a22d5..fdc77c9cec5 100644--- a/packages/features/webhooks/lib/factory/base/BaseDelegationPayloadBuilder.ts+++ b/packages/features/webhooks/lib/factory/base/BaseDelegationPayloadBuilder.ts@@ -18,4 +18,3 @@ export abstract class BaseDelegationPayloadBuilder implements IDelegationPayload*/abstract build(dto: DelegationCredentialErrorDTO): WebhookPayload;}-diff --git a/packages/features/webhooks/lib/factory/base/BaseFormPayloadBuilder.test.ts b/packages/features/webhooks/lib/factory/base/BaseFormPayloadBuilder.test.tsindex 62fe9182554..4cfc767d058 100644--- a/packages/features/webhooks/lib/factory/base/BaseFormPayloadBuilder.test.ts+++ b/packages/features/webhooks/lib/factory/base/BaseFormPayloadBuilder.test.ts@@ -8,7 +8,9 @@ describe("FormPayloadBuilder (v2021-10-20)", () => {const builder = new FormPayloadBuilder();const createMockDTO = (- triggerEvent: typeof WebhookTriggerEvents.FORM_SUBMITTED | typeof WebhookTriggerEvents.FORM_SUBMITTED_NO_EVENT+ triggerEvent:+ | typeof WebhookTriggerEvents.FORM_SUBMITTED+ | typeof WebhookTriggerEvents.FORM_SUBMITTED_NO_EVENT): FormSubmittedDTO | FormSubmittedNoEventDTO =>({triggerEvent,diff --git a/packages/features/webhooks/lib/factory/versioned/PayloadBuilderFactory.test.ts b/packages/features/webhooks/lib/factory/versioned/PayloadBuilderFactory.test.tsindex 40d89334fee..903363a5807 100644--- a/packages/features/webhooks/lib/factory/versioned/PayloadBuilderFactory.test.ts+++ b/packages/features/webhooks/lib/factory/versioned/PayloadBuilderFactory.test.ts@@ -127,14 +127,20 @@ describe("PayloadBuilderFactory", () => {});it("should route instant meeting events to instant meeting builder", () => {- const builder = factory.getBuilder(WebhookVersionEnum.V_2021_10_20, WebhookTriggerEvents.INSTANT_MEETING);+ const builder = factory.getBuilder(+ WebhookVersionEnum.V_2021_10_20,+ WebhookTriggerEvents.INSTANT_MEETING+ );expect(builder).toBe(defaultBuilders.instantMeeting);});});describe("Fallback Behavior", () => {it("should fallback to default version when requested version not found", () => {- const builder = factory.getBuilder(WebhookVersionEnum.V_2099_99_99, WebhookTriggerEvents.BOOKING_CREATED);+ const builder = factory.getBuilder(+ WebhookVersionEnum.V_2099_99_99,+ WebhookTriggerEvents.BOOKING_CREATED+ );// Should get default builder, not throwexpect(builder).toBe(defaultBuilders.booking);@@ -159,12 +165,30 @@ describe("PayloadBuilderFactory", () => {describe("Type Safety", () => {it("should return correctly typed builder for each trigger", () => {// These type assertions verify compile-time type safety- const bookingBuilder = factory.getBuilder(WebhookVersionEnum.V_2021_10_20, WebhookTriggerEvents.BOOKING_CREATED);- const formBuilder = factory.getBuilder(WebhookVersionEnum.V_2021_10_20, WebhookTriggerEvents.FORM_SUBMITTED);- const oooBuilder = factory.getBuilder(WebhookVersionEnum.V_2021_10_20, WebhookTriggerEvents.OOO_CREATED);- const recordingBuilder = factory.getBuilder(WebhookVersionEnum.V_2021_10_20, WebhookTriggerEvents.RECORDING_READY);- const meetingBuilder = factory.getBuilder(WebhookVersionEnum.V_2021_10_20, WebhookTriggerEvents.MEETING_STARTED);- const instantBuilder = factory.getBuilder(WebhookVersionEnum.V_2021_10_20, WebhookTriggerEvents.INSTANT_MEETING);+ const bookingBuilder = factory.getBuilder(+ WebhookVersionEnum.V_2021_10_20,+ WebhookTriggerEvents.BOOKING_CREATED+ );+ const formBuilder = factory.getBuilder(+ WebhookVersionEnum.V_2021_10_20,+ WebhookTriggerEvents.FORM_SUBMITTED+ );+ const oooBuilder = factory.getBuilder(+ WebhookVersionEnum.V_2021_10_20,+ WebhookTriggerEvents.OOO_CREATED+ );+ const recordingBuilder = factory.getBuilder(+ WebhookVersionEnum.V_2021_10_20,+ WebhookTriggerEvents.RECORDING_READY+ );+ const meetingBuilder = factory.getBuilder(+ WebhookVersionEnum.V_2021_10_20,+ WebhookTriggerEvents.MEETING_STARTED+ );+ const instantBuilder = factory.getBuilder(+ WebhookVersionEnum.V_2021_10_20,+ WebhookTriggerEvents.INSTANT_MEETING+ );// Runtime verificationexpect(bookingBuilder).toBeDefined();@@ -221,7 +245,10 @@ describe("PayloadBuilderFactory", () => {},};- const builder = factory.getBuilder(WebhookVersionEnum.V_2021_10_20, WebhookTriggerEvents.BOOKING_CREATED);+ const builder = factory.getBuilder(+ WebhookVersionEnum.V_2021_10_20,+ WebhookTriggerEvents.BOOKING_CREATED+ );const payload = builder.build(mockDTO);expect(payload).toBeDefined();@@ -244,8 +271,14 @@ describe("PayloadBuilderFactory", () => {factory.registerVersion(WebhookVersionEnum.V_2024_12_01, v2Builders);// Both versions should work- const v1Builder = factory.getBuilder(WebhookVersionEnum.V_2021_10_20, WebhookTriggerEvents.BOOKING_CREATED);- const v2Builder = factory.getBuilder(WebhookVersionEnum.V_2024_12_01, WebhookTriggerEvents.BOOKING_CREATED);+ const v1Builder = factory.getBuilder(+ WebhookVersionEnum.V_2021_10_20,+ WebhookTriggerEvents.BOOKING_CREATED+ );+ const v2Builder = factory.getBuilder(+ WebhookVersionEnum.V_2024_12_01,+ WebhookTriggerEvents.BOOKING_CREATED+ );expect(v1Builder).toBe(defaultBuilders.booking);expect(v2Builder).toBe(v2Builders.booking);@@ -253,4 +286,3 @@ describe("PayloadBuilderFactory", () => {});});});-diff --git a/packages/features/webhooks/lib/factory/versioned/registry.test.ts b/packages/features/webhooks/lib/factory/versioned/registry.test.tsindex 4e4316b5472..7a807595cc4 100644--- a/packages/features/webhooks/lib/factory/versioned/registry.test.ts+++ b/packages/features/webhooks/lib/factory/versioned/registry.test.ts@@ -18,12 +18,24 @@ describe("Payload Builder Registry", () => {const factory = createPayloadBuilderFactory();// Test each builder category by trigger event- const bookingBuilder = factory.getBuilder(DEFAULT_WEBHOOK_VERSION, WebhookTriggerEvents.BOOKING_CREATED);+ const bookingBuilder = factory.getBuilder(+ DEFAULT_WEBHOOK_VERSION,+ WebhookTriggerEvents.BOOKING_CREATED+ );const formBuilder = factory.getBuilder(DEFAULT_WEBHOOK_VERSION, WebhookTriggerEvents.FORM_SUBMITTED);const oooBuilder = factory.getBuilder(DEFAULT_WEBHOOK_VERSION, WebhookTriggerEvents.OOO_CREATED);- const recordingBuilder = factory.getBuilder(DEFAULT_WEBHOOK_VERSION, WebhookTriggerEvents.RECORDING_READY);- const meetingBuilder = factory.getBuilder(DEFAULT_WEBHOOK_VERSION, WebhookTriggerEvents.MEETING_STARTED);- const instantBuilder = factory.getBuilder(DEFAULT_WEBHOOK_VERSION, WebhookTriggerEvents.INSTANT_MEETING);+ const recordingBuilder = factory.getBuilder(+ DEFAULT_WEBHOOK_VERSION,+ WebhookTriggerEvents.RECORDING_READY+ );+ const meetingBuilder = factory.getBuilder(+ DEFAULT_WEBHOOK_VERSION,+ WebhookTriggerEvents.MEETING_STARTED+ );+ const instantBuilder = factory.getBuilder(+ DEFAULT_WEBHOOK_VERSION,+ WebhookTriggerEvents.INSTANT_MEETING+ );expect(bookingBuilder).toBeDefined();expect(formBuilder).toBeDefined();@@ -52,7 +64,10 @@ describe("Payload Builder Registry", () => {const factory = createPayloadBuilderFactory();// Request non-existent version (cast to WebhookVersion for testing fallback)- const builder = factory.getBuilder("9999-99-99" as WebhookVersion, WebhookTriggerEvents.BOOKING_CREATED);+ const builder = factory.getBuilder(+ "9999-99-99" as WebhookVersion,+ WebhookTriggerEvents.BOOKING_CREATED+ );// Should get default builder, not throwexpect(builder).toBeDefined();@@ -144,4 +159,3 @@ describe("Payload Builder Registry", () => {});});});-diff --git a/packages/features/webhooks/lib/factory/versioned/v2021-10-20/BookingPayloadBuilder.test.ts b/packages/features/webhooks/lib/factory/versioned/v2021-10-20/BookingPayloadBuilder.test.tsindex 7816527dad3..8a366dac144 100644--- a/packages/features/webhooks/lib/factory/versioned/v2021-10-20/BookingPayloadBuilder.test.ts+++ b/packages/features/webhooks/lib/factory/versioned/v2021-10-20/BookingPayloadBuilder.test.ts@@ -150,4 +150,3 @@ describe("v2021-10-20/BookingPayloadBuilder", () => {expect(() => builder.build(minimalDTO)).not.toThrow();});});-diff --git a/packages/features/webhooks/lib/factory/versioned/v2021-10-20/DelegationPayloadBuilder.ts b/packages/features/webhooks/lib/factory/versioned/v2021-10-20/DelegationPayloadBuilder.tsindex 5103c749999..ad388176e9e 100644--- a/packages/features/webhooks/lib/factory/versioned/v2021-10-20/DelegationPayloadBuilder.ts+++ b/packages/features/webhooks/lib/factory/versioned/v2021-10-20/DelegationPayloadBuilder.ts@@ -28,4 +28,3 @@ export class DelegationPayloadBuilder extends BaseDelegationPayloadBuilder {};}}-diff --git a/packages/features/webhooks/lib/getWebhooks.ts b/packages/features/webhooks/lib/getWebhooks.tsindex c46efe2f0c9..b132388e835 100644--- a/packages/features/webhooks/lib/getWebhooks.ts+++ b/packages/features/webhooks/lib/getWebhooks.ts@@ -15,7 +15,6 @@ export type GetSubscriberOptions = {oAuthClientId?: string | null;};-const getWebhooks = async (options: GetSubscriberOptions,prisma: PrismaClient = defaultPrismadiff --git a/packages/features/webhooks/lib/handleWebhookScheduledTriggers.test.ts b/packages/features/webhooks/lib/handleWebhookScheduledTriggers.test.tsindex 4e4f8ef333c..6a5fcc289ae 100644--- a/packages/features/webhooks/lib/handleWebhookScheduledTriggers.test.ts+++ b/packages/features/webhooks/lib/handleWebhookScheduledTriggers.test.ts@@ -81,7 +81,7 @@ describe("handleWebhookScheduledTriggers - X-Cal-Webhook-Version header", () =>};await handleWebhookScheduledTriggers(mockPrisma as unknown as PrismaClient);-+expect(mockFetch).toHaveBeenCalledTimes(1);const [, options] = mockFetch.mock.calls[0];diff --git a/packages/features/webhooks/lib/handleWebhookScheduledTriggers.ts b/packages/features/webhooks/lib/handleWebhookScheduledTriggers.tsindex b32fc28ab4d..c900e9df176 100644--- a/packages/features/webhooks/lib/handleWebhookScheduledTriggers.ts+++ b/packages/features/webhooks/lib/handleWebhookScheduledTriggers.ts@@ -69,7 +69,7 @@ export async function handleWebhookScheduledTriggers(prisma: PrismaClient) {body: job.payload,headers,// Avoid following redirect- redirect: "manual"+ redirect: "manual",}).catch((error) => {console.error(`Webhook trigger for subscriber url ${job.subscriberUrl} failed with error: ${error}`);})diff --git a/packages/features/webhooks/lib/infrastructure/mappers/WebhookOutputMapper.ts b/packages/features/webhooks/lib/infrastructure/mappers/WebhookOutputMapper.tsindex c36f5288cbf..697a339c8b2 100644--- a/packages/features/webhooks/lib/infrastructure/mappers/WebhookOutputMapper.ts+++ b/packages/features/webhooks/lib/infrastructure/mappers/WebhookOutputMapper.ts@@ -131,4 +131,3 @@ export class WebhookOutputMapper {};}}-diff --git a/packages/features/webhooks/lib/service/WebhookNotificationHandler.test.ts b/packages/features/webhooks/lib/service/WebhookNotificationHandler.test.tsindex 6d0342b8856..87a51dd8f4e 100644--- a/packages/features/webhooks/lib/service/WebhookNotificationHandler.test.ts+++ b/packages/features/webhooks/lib/service/WebhookNotificationHandler.test.ts@@ -154,7 +154,10 @@ describe("WebhookNotificationHandler", () => {it("should use factory to build payload", async () => {await handler.handleNotification(mockDTO);- expect(mockFactory.getBuilder).toHaveBeenCalledWith(WebhookVersion.V_2021_10_20, WebhookTriggerEvents.BOOKING_CREATED);+ expect(mockFactory.getBuilder).toHaveBeenCalledWith(+ WebhookVersion.V_2021_10_20,+ WebhookTriggerEvents.BOOKING_CREATED+ );});it("should process webhooks with built payload", async () => {@@ -302,8 +305,10 @@ describe("WebhookNotificationHandler", () => {await handler.handleNotification(dto);- expect(mockFactory.getBuilder).toHaveBeenCalledWith(WebhookVersion.V_2021_10_20, WebhookTriggerEvents.BOOKING_CREATED);+ expect(mockFactory.getBuilder).toHaveBeenCalledWith(+ WebhookVersion.V_2021_10_20,+ WebhookTriggerEvents.BOOKING_CREATED+ );});});});-diff --git a/packages/features/webhooks/lib/service/WebhookNotificationHandler.ts b/packages/features/webhooks/lib/service/WebhookNotificationHandler.tsindex d379ffbb136..95ad063f79d 100644--- a/packages/features/webhooks/lib/service/WebhookNotificationHandler.ts+++ b/packages/features/webhooks/lib/service/WebhookNotificationHandler.ts@@ -77,7 +77,10 @@ export class WebhookNotificationHandler implements IWebhookNotificationHandler {* 2. Build version-specific payloads per subscriber* 3. Group subscribers by version for efficiency*/- private createPayload(dto: WebhookEventDTO, version: WebhookVersion = DEFAULT_WEBHOOK_VERSION): WebhookPayload {+ private createPayload(+ dto: WebhookEventDTO,+ version: WebhookVersion = DEFAULT_WEBHOOK_VERSION+ ): WebhookPayload {// Get version-specific builder from factory - handles all event typesconst builder = this.payloadBuilderFactory.getBuilder(version, dto.triggerEvent);return builder.build(dto);diff --git a/packages/features/webhooks/lib/service/WebhookNotifier.ts b/packages/features/webhooks/lib/service/WebhookNotifier.tsindex 4cc924f153e..5e5a4b16402 100644--- a/packages/features/webhooks/lib/service/WebhookNotifier.ts+++ b/packages/features/webhooks/lib/service/WebhookNotifier.ts@@ -5,7 +5,10 @@ import type { IWebhookNotifier, IWebhookNotificationHandler } from "../interfaceexport class WebhookNotifier implements IWebhookNotifier {private readonly log: ILogger;- constructor(private readonly handler: IWebhookNotificationHandler, logger: ILogger) {+ constructor(+ private readonly handler: IWebhookNotificationHandler,+ logger: ILogger+ ) {this.log = logger.getSubLogger({ prefix: ["[WebhookNotifier]"] });}diff --git a/packages/features/webhooks/lib/service/WebhookService.test.ts b/packages/features/webhooks/lib/service/WebhookService.test.tsindex 87db5f2bfca..1e96e91da47 100644--- a/packages/features/webhooks/lib/service/WebhookService.test.ts+++ b/packages/features/webhooks/lib/service/WebhookService.test.ts@@ -72,7 +72,11 @@ describe("WebhookService", () => {describe("X-Cal-Webhook-Version header", () => {it("should include X-Cal-Webhook-Version header when sending webhook directly", async () => {- const service = new WebhookService(mockRepository as unknown as IWebhookRepository, mockTasker as unknown as ITasker, mockLogger as unknown as ILogger);+ const service = new WebhookService(+ mockRepository as unknown as IWebhookRepository,+ mockTasker as unknown as ITasker,+ mockLogger as unknown as ILogger+ );const subscriber: WebhookSubscriber = {id: "webhook-1",@@ -101,7 +105,11 @@ describe("WebhookService", () => {});it("should include correct version for each subscriber", async () => {- const service = new WebhookService(mockRepository as unknown as IWebhookRepository, mockTasker as unknown as ITasker, mockLogger as unknown as ILogger);+ const service = new WebhookService(+ mockRepository as unknown as IWebhookRepository,+ mockTasker as unknown as ITasker,+ mockLogger as unknown as ILogger+ );const subscriber1: WebhookSubscriber = {id: "webhook-1",@@ -128,7 +136,10 @@ describe("WebhookService", () => {payload: { test: "data", triggerEvent: WebhookTriggerEvents.BOOKING_CREATED },} as unknown as WebhookPayload;- await service.processWebhooks(WebhookTriggerEvents.BOOKING_CREATED, payload, [subscriber1, subscriber2]);+ await service.processWebhooks(WebhookTriggerEvents.BOOKING_CREATED, payload, [+ subscriber1,+ subscriber2,+ ]);expect(mockFetch).toHaveBeenCalledTimes(2);@@ -142,7 +153,11 @@ describe("WebhookService", () => {it("should schedule webhook with version when TASKER_ENABLE_WEBHOOKS is enabled", async () => {process.env.TASKER_ENABLE_WEBHOOKS = "1";- const service = new WebhookService(mockRepository as unknown as IWebhookRepository, mockTasker as unknown as ITasker, mockLogger as unknown as ILogger);+ const service = new WebhookService(+ mockRepository as unknown as IWebhookRepository,+ mockTasker as unknown as ITasker,+ mockLogger as unknown as ILogger+ );const subscriber: WebhookSubscriber = {id: "webhook-1",diff --git a/packages/features/webhooks/lib/tasker/trigger/deliver-webhook.ts b/packages/features/webhooks/lib/tasker/trigger/deliver-webhook.tsindex 94909275dea..834af8cfa0f 100644--- a/packages/features/webhooks/lib/tasker/trigger/deliver-webhook.ts+++ b/packages/features/webhooks/lib/tasker/trigger/deliver-webhook.ts@@ -20,29 +20,33 @@ const WEBHOOK_DELIVERY_JOB_ID = "webhook.deliver" as const;** Errors are logged and re-thrown to enable trigger.dev's retry mechanism.*/-export const deliverWebhook: TaskWithSchema<typeof WEBHOOK_DELIVERY_JOB_ID, typeof webhookDeliveryTaskSchema> =- schemaTask({- id: WEBHOOK_DELIVERY_JOB_ID,- ...webhookDeliveryTaskConfig,- schema: webhookDeliveryTaskSchema,- run: async (payload: WebhookTaskPayload, { ctx }) => {- const { getWebhookTaskConsumer } = await import(- "@calcom/features/di/webhooks/containers/webhook"- );+export const deliverWebhook: TaskWithSchema<+ typeof WEBHOOK_DELIVERY_JOB_ID,+ typeof webhookDeliveryTaskSchema+> = schemaTask({+ id: WEBHOOK_DELIVERY_JOB_ID,+ ...webhookDeliveryTaskConfig,+ schema: webhookDeliveryTaskSchema,+ run: async (payload: WebhookTaskPayload, { ctx }) => {+ const { getWebhookTaskConsumer } = await import("@calcom/features/di/webhooks/containers/webhook");- const webhookTaskConsumer = getWebhookTaskConsumer();- const taskId = ctx.run.id;+ const webhookTaskConsumer = getWebhookTaskConsumer();+ const taskId = ctx.run.id;- try {- await webhookTaskConsumer.processWebhookTask(payload, taskId);- logger.info("Webhook delivered successfully", { operationId: payload.operationId, taskId });- } catch (error) {- if (error instanceof Error || error instanceof ErrorWithCode) {- logger.error(error.message, { operationId: payload.operationId, taskId });- } else {- logger.error("Unknown error in webhook delivery", { error, operationId: payload.operationId, taskId });- }- throw error;+ try {+ await webhookTaskConsumer.processWebhookTask(payload, taskId);+ logger.info("Webhook delivered successfully", { operationId: payload.operationId, taskId });+ } catch (error) {+ if (error instanceof Error || error instanceof ErrorWithCode) {+ logger.error(error.message, { operationId: payload.operationId, taskId });+ } else {+ logger.error("Unknown error in webhook delivery", {+ error,+ operationId: payload.operationId,+ taskId,+ });}- },- });+ throw error;+ }+ },+});