e073cbd5ea54d59cd8a2bfa8e0287587d5aa692c
170
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
4291a59b2c |
fix: add missing vi.mock() calls to prevent vitest worker shutdown flakiness (#28459)
* fix: add missing vi.mock() calls to prevent vitest worker shutdown flakiness
Add vi.mock() calls for modules that trigger background network requests
or database connections during import. These transitive imports can cause
the vitest worker RPC to shut down while pending fetch/network operations
are still in flight, resulting in flaky test failures with:
Error: [vitest-worker]: Closing rpc while "fetch" was pending
The primary modules mocked are:
- @calcom/app-store/delegationCredential (triggers credential lookups)
- @calcom/prisma (triggers database initialization)
- @calcom/features/calendars/lib/CalendarManager (triggers calendar API calls)
- @calcom/features/auth/lib/verifyEmail (triggers email service)
- @calcom/lib/domainManager/organization (triggers domain lookups)
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* fix: remove conflicting empty prisma mocks from files with prismock/prismaMock setups
- Remove vi.mock('@calcom/prisma', () => ({ default: {}, prisma: {} })) from 28 files
that already have prismock/prismaMock test doubles. Vitest hoists all vi.mock() calls
and the last one wins, so these empty mocks were overriding the functional test doubles.
- Fix CalendarSubscriptionService.test.ts to reuse the shared mock from
__mocks__/delegationCredential instead of creating a new unconfigured vi.fn()
- Remove DelegationCredentialRepository.test.ts empty prisma mock (different pattern)
- Remove vi.mock from inside beforeEach in intentToCreateOrg.handler.test.ts
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* fix: add comprehensive delegationCredential mock exports to prevent CI test failures
The vi.mock blocks for @calcom/app-store/delegationCredential were missing
exports that the code under test transitively imports (e.g.
enrichUsersWithDelegationCredentials, enrichUserWithDelegationCredentialsIncludeServiceAccountKey,
buildAllCredentials, getFirstDelegationConferencingCredentialAppLocation).
Added all exports with passthrough implementations so the booking flow
works correctly without triggering real network requests.
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* fix: correct credential mock return shapes to match real module API
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* fix: revert unintended yarn.lock changes
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
||
|
|
5993889616 |
feat: make impersonatedByUserUuid required across booking audit flows (#26546)
* Integrate creation/rescheduling booking audit * fix: add missing hostUserUuid to booking audit test data Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * fix-ci * feat: enhance booking audit with seat reference - Added support for seat reference in booking audit actions. - Updated localization for booking creation to include seat information. - Modified relevant services to pass attendee seat ID during booking creation. * fix: update test data to match schema requirements - Add seatReferenceUid: null to default mock audit log data - Add seatReferenceUid: null to multiple audit logs test case - Convert SEAT_RESCHEDULED test data to use numeric timestamps instead of ISO strings Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * Allow nullish seatReferenceUid * feat: enhance booking audit to support rescheduledBy information - Updated booking audit actions to include rescheduledBy details, allowing tracking of who rescheduled a booking. - Refactored related services to accommodate the new rescheduledBy parameter in booking events. - Adjusted type definitions and function signatures to reflect the changes in the booking audit context. * Avoid possible run time issue * Fix imoport path * fix failing test due to merge from main\ * Pass useruuid * chore: retrigger CI (flaky unit test) Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * feat: add context parameter to bulk audit methods for impersonation support - Add context parameter to queueBulkCreatedAudit and queueBulkRescheduledAudit in BookingAuditProducerService interface - Add context parameter to BookingAuditTaskerProducerService implementation - Add context parameter to onBulkBookingsCreated and onBulkBookingsRescheduled in BookingEventHandlerService - Update RegularBookingService.fireBookingEvents to accept and pass impersonation context - Update RecurringBookingService.fireBookingEvents to accept and pass impersonation context - Update handleSeats to accept and pass impersonation context Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * chore: Integrate mark-no-show booking audit Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * fix: Simplify host no-show audit and add comment for attendee actor Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * feat: make impersonatedByUserUuid required with explicit null for non-impersonation cases Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * feat: integrate impersonatedByUserUuid into booking cancellation audit flow - Add impersonatedByUserUuid to CancelBookingInput and CancelBookingMeta types - Pass audit context with impersonatedBy to onBookingCancelled and onBulkBookingsCancelled - Update all cancel booking call sites to pass impersonatedByUserUuid: - Web app cancel route: uses session impersonatedBy - API v1 and v2: explicitly set to null (no impersonation support) Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * refactor: make impersonatedByUserUuid optional and remove explicit null assignments - Changed impersonatedByUserUuid from required (string | null) to optional (string?) - Removed explicit null assignments from API v1 and v2 endpoints - Keep impersonatedByUserUuid only where impersonation actually occurs (web app) Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * Apply suggestions from code review Rfemove unnecessary comment * fix: restore bookingMeta variable in createBookingForApiV1 Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * fix: Make actionSource required with ValidActionSource type and remove unnecessary comments Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * fix: Remove merge conflict markers from bookings.service.ts Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * feat: implement SYSTEM as a booking audit source for background tasks, including no-show triggers. * refactor: Move prisma query to BookingRepository for audit logging Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * Conflict resolution * refactor: introduce `handleMarkHostNoShow` for public viewer and standardize actor and action source parameters for no-show actions. * refactor: Combine HostNoShowUpdatedAuditActionService and AttendeeNoShowUpdatedAuditActionService into NoShowUpdatedActionService - Create new NoShowUpdatedAuditActionService with combined schema supporting both noShowHost and noShowAttendee as optional fields - Update BookingAuditActionServiceRegistry to use combined service with NO_SHOW_UPDATED action type - Update BookingAuditTaskerProducerService with single queueNoShowUpdatedAudit method - Update BookingAuditProducerService.interface.ts with combined method - Update BookingEventHandlerService with single onNoShowUpdated method - Update handleMarkNoShow.ts to use combined audit service - Update tasker tasks (triggerGuestNoShow, triggerHostNoShow) to use combined service - Add NO_SHOW_UPDATED to Prisma BookingAuditAction enum - Remove old separate HostNoShowUpdatedAuditActionService and AttendeeNoShowUpdatedAuditActionService files This allows a single API action (e.g., API V2 markAbsent) that updates both host and attendee no-show status to be logged as a single audit event. Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * chore: Add migration for NO_SHOW_UPDATED audit action enum value Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * refactor: Update no-show audit schema to use host and attendees array - Rename noShowHost to host and noShowAttendee to attendees (remove redundant prefix) - Change attendees from single value to array to support multiple attendees in single audit entry - Update handleMarkNoShow.ts to create single audit entry for all attendees - Update tasker tasks (triggerGuestNoShow, triggerHostNoShow) to use new schema - Update display data types to reflect new schema structure Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * Update schema to be more clear. Call onNoShowUpdated immediately after DB update as audit only cares about DB update, and this would avoid any accidental Audit update on DB change * chore: accommodate schema changes and fix type errors for no-show audit Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * fix: Update migration to remove old no-show enum values Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * fix: Use updated attendees in webhook payload for guest no-show Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * fix: Remove duplicate imports and fix actor parameter in bookings.service.ts Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * refactor: Move booking query to BookingRepository and remove unused method Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * refactor: centralize no-show audit event firing and attendee fetching within `handleMarkNoShow` for improved clarity. * fix: Build attendeesNoShow as Record with attendee IDs as keys Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * Fix and add tests for handleMarkBoShow * refactor: Move prisma queries to AttendeeRepository and BookingRepository Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * fix: Correct return type for updateNoShow method (noShow can be null) Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * fix: Update handleMarkNoShow tests to mock new repository methods Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * fix triggerGuestNoShow * refactor: Move triggerGuestNoShow queries to AttendeeRepository and add unit tests - Add new methods to AttendeeRepository: - findByBookingId: Get attendees with id, email, noShow - findByBookingIdWithDetails: Get full attendee details - updateManyNoShowByBookingIdAndEmails: Update specific attendees - updateManyNoShowByBookingIdExcludingEmails: Update all except specific emails - Refactor triggerGuestNoShow.ts to use AttendeeRepository instead of direct Prisma calls - Add comprehensive unit tests for triggerGuestNoShow following handleMarkNoShow.test.ts pattern: - Mock repositories and external services - In-memory DB simulation - Test core functionality, audit logging, webhook payload, error handling, and edge cases Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * refactor: Move triggerHostNoShow queries to repositories and delete unit test file Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * refactor: Convert repository methods to use named parameters objects Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * refactor: Enhance no-show handling by consolidating audit logging and updating repository interactions - Refactor `buildResultPayload` to accept a structured argument for better clarity. - Update `updateAttendees` to use a named parameter object for improved readability. - Introduce `fireNoShowUpdatedEvent` to centralize no-show audit logging for both hosts and guests. - Remove redundant methods and streamline attendee retrieval in `AttendeeRepository`. - Add comprehensive unit tests for no-show event handling, ensuring accurate audit logging and webhook triggering. * test: Add tests for handleMarkHostNoShow guest actor and unmarking host no-show Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * fix: update attendeesNoShow validation to handle numeric keys - Changed attendeesNoShow schema to use z.coerce.number() for key validation, ensuring string keys are correctly coerced to numbers. - Updated test to validate attendeesNoShow data using numeric key comparison, improving robustness of the audit data checks. * test: Add integration tests for NoShowUpdatedAuditActionService coerce fix Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * feat: add graceful error handling for audit log enrichment - Add hasError field to EnrichedAuditLog type - Create buildFallbackAuditLog() method for failed enrichments - Wrap enrichAuditLog() in try-catch to handle errors gracefully - Add booking_audit_action.error_processing translation key - Update BookingHistory.tsx to show warning icon for error logs - Hide 'Show details' button for logs with hasError - Add comprehensive test cases for error handling scenarios Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * feat: Enhance booking audit action services with new display fields and improved validation - Added "attendee_no_show_updated" and "no_show_updated" translations to common.json. - Updated IAuditActionService to include new methods for handling display fields and migration. - Enhanced NoShowUpdatedAuditActionService to differentiate between host and attendee no-show updates. - Improved ReassignmentAuditActionService to ensure consistent handling of audit data. - Refactored BookingAuditViewerService for better clarity and maintainability. * refactor: Use attendeeEmail instead of attendeeId as key in audit data and store host's userUuid - Updated schema to use attendee email as key instead of attendee ID because attendee records can be reused with different person's data - Store host's userUuid in audit data with format: host: { userUuid, noShow: { old, new } } - Updated fireNoShowUpdated to accept hostUserUuid parameter - Added uuid field to BookingRepository.findByUidIncludeEventTypeAttendeesAndUser - Updated NoShowUpdatedAuditActionService getDisplayFields to work with email-based keys - Added attendeeRepository to DI modules for BookingAuditTaskConsumer - Updated tests to match new schema format Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * test: Update integration tests to use new schema format with host.userUuid and email keys Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * fix: correct audit schema for SYSTEM source and ensure attendee lookup by bookingId - Fix schema inconsistency: use host.userUuid format instead of hostNoShow - Add user.uuid to getBooking select for audit logging - Log warning when hostUserUuid is undefined but host no-show is being updated - Use email as key for attendeesNoShow (not attendee ID) to match schema - Fetch attendees by bookingId before updating to ensure correct scoping - Remove unused safeStringify import * refactor: Change attendeesNoShow schema from Record to Array format - Update NoShowUpdatedAuditActionService schema to use array format: attendeesNoShow: Array<{attendeeEmail: string, noShow: {old, new}}> - Update handleMarkNoShow.ts to build attendeesNoShow as array - Update common.ts fireNoShowUpdatedEvent to convert Map to array - Update all tests to use new array format with attendeeEmail property Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * refactor: Update attendeesNoShow schema to use array format in triggerNoShow tasks - Refactor `triggerGuestNoShow` and `triggerHostNoShow` to replace Map with array for `attendeesNoShowAudit`. - Update `fireNoShowUpdatedEvent` to handle the new array format for attendees. - Ensure consistent data structure across no-show audit logging for better clarity and maintainability. * fix: Update ReassignmentAuditActionService to use GetDisplayFieldsParams interface Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * fix: Update ReassignmentAuditActionService tests to use GetDisplayFieldsParams interface Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * fix: Use handleMarkAttendeeNoShow for API v2 mark absent endpoint - Export handleMarkAttendeeNoShow from platform-libraries - Update API v2 bookings service to use handleMarkAttendeeNoShow with actionSource - Add validation for userUuid before calling handleMarkAttendeeNoShow Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * refactor: Enhance display fields structure in booking audit components - Updated `BookingHistory.tsx` to allow for more flexible display fields, including optional raw values and arrays of values. - Introduced `DisplayFieldValue` component for rendering display fields, improving clarity and maintainability. - Adjusted `IAuditActionService` and `NoShowUpdatedAuditActionService` to align with the new display fields structure. - Ensured consistent handling of display fields across the booking audit service for better data representation. * fix: Remove debug code that duplicated first attendee in display fields Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * refactor: Update attendee repository methods to use structured parameters - Modified `updateNoShow`, `updateManyNoShowByBookingIdAndEmails`, and `updateManyNoShowByBookingIdExcludingEmails` methods to accept structured `where` and `data` parameters for better clarity and maintainability. - Updated calls to these methods throughout the codebase to reflect the new parameter structure. - Removed unused `findByIdWithNoShow` method and adjusted related logic to streamline attendee data retrieval. * feat: Add infrastructure for no-show audit integration - Add Prisma migrations for SYSTEM source and NO_SHOW_UPDATED audit action - Add NoShowUpdatedAuditActionService with array-based attendeesNoShow schema - Update BookingAuditActionServiceRegistry to include NO_SHOW_UPDATED - Update BookingAuditTaskConsumer and BookingAuditViewerService - Add AttendeeRepository methods for no-show queries - Update IAuditActionService interface with values array support - Update locales with no-show audit translation keys Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * fix: Add NO_SHOW_UPDATED to BookingAuditAction and SYSTEM to ActionSource types Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * fix: Remove HOST_NO_SHOW_UPDATED and ATTENDEE_NO_SHOW_UPDATED from BookingAuditAction type to match Prisma schema Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * fix: Update BookingAuditActionSchema to use NO_SHOW_UPDATED instead of HOST_NO_SHOW_UPDATED and ATTENDEE_NO_SHOW_UPDATED Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * refactor: Remove deprecated no-show audit services and unify to NoShowUpdatedAuditActionService - Delete HostNoShowUpdatedAuditActionService and AttendeeNoShowUpdatedAuditActionService - Update BookingAuditProducerService.interface.ts to use queueNoShowUpdatedAudit - Update BookingAuditTaskerProducerService.ts to use queueNoShowUpdatedAudit - Update BookingEventHandlerService.ts to use onNoShowUpdated - Add integration tests for NoShowUpdatedAuditActionService Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * fix: Update test mock to match new AttendeeRepository.updateNoShow signature Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * refactor: rename handleMarkAttendeeNoShow to handleMarkNoShow and update related types - Renamed `handleMarkAttendeeNoShow` to `handleMarkNoShow` for clarity. - Updated type definitions to reflect the new naming convention. - Modified the `markNoShow` handler to require `userUuid` and adjusted related logic. - Enhanced the `fireNoShowUpdatedEvent` to accommodate changes in event type structure. - Updated references across various files to ensure consistency with the new function name. * handle null value * fix: add explicit parentheses for operator precedence clarity Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * Fix cubic reported bug * feat: add impersonation audit support to no-show flow (#27601) Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * feat: add impersonatedByUserUuid context to all BookingEventHandler calls (#27602) - Add context parameter to confirm.handler.ts (onBulkBookingsRejected, onBookingRejected) - Add context parameter to requestReschedule.handler.ts (onRescheduleRequested) - Add context parameter to editLocation.handler.ts (onLocationChanged) - Add context parameter to addGuests.handler.ts (onAttendeeAdded) - Add context parameter to handleConfirmation.ts (onBulkBookingsAccepted, onBookingAccepted) - Update _router.tsx to pass impersonatedByUserUuid from session to handlers This ensures all BookingEventHandler method calls that have loggedInUser context now properly support impersonation tracking for audit logging. Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * fix: remove stray merge artifact in RegularBookingService Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * fix: remove duplicate imports in BookingRepository Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * fix: resolve type errors and duplicate declarations from merge Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * fix: remove duplicate test assertions and duplicate test from merge artifacts Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * fix: remove redundant ?? undefined from impersonatedByUserUuid Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * fix: update impersonatedByUserUuid type to string | null for consistency Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * fix: make impersonatedByUserUuid required in booking audit flows Changes impersonatedByUserUuid from optional (?: string | null) to required (: string | null) in all booking-related type definitions. This ensures audit-critical parameters are never accidentally omitted. Fixed all call sites to explicitly pass the value or null. Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * fix: add impersonatedByUserUuid to remaining callers and tests Adds impersonatedByUserUuid: null to API v1, API v2, and test callers of handleCancelBooking that were missing the now-required parameter. Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * fix: require impersonatedByUserUuid in DTOs and pass it across all booking flows (coalesce to null) Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * fix: add impersonatedByUserUuid to remaining call sites (confirm, markNoShow, webhook, tests) Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * fix: add impersonatedByUserUuid to confirm handler test and API v2 confirm/decline calls Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * fix: derive impersonatedByUserUuid from session in reportBooking handler instead of hardcoding null Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * fix: reorder spread to ensure impersonatedByUserUuid null fallback is not overwritten Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * fix: add missing impersonatedByUserUuid to CalendarSyncService cancel and reschedule calls Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * fix: update CalendarSyncService tests to expect impersonatedByUserUuid Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * ci: retrigger failed checks (attempt 1) Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * ci: retrigger failed checks (attempt 2) Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * ci: retrigger failed checks (attempt 3) Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * chore: bust prisma cache with comment change Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * ci: retrigger after cache bust (attempt 2) Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * ci: retrigger after cache bust (attempt 3) Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com> Co-authored-by: Volnei Munhoz <volnei@cal.com> |
||
|
|
e2add3f2c9 |
feat: enable microsoft sign ups (#28080)
* fix: trigger lingo.dev by removing duplicate value * under progress * wow this worked * migrate schema * fix types * fix import for google login * Add onboarding tests for Azure (Microsoft sign up) * add comments back * fix failing test * fix: update Outlook login configuration and improve type safety in authentication adapter - Set OUTLOOK_LOGIN_ENABLED to false in .env.example - Refactor getServerSideProps to directly use samlTenantID and samlProductID - Update linkAccount method in next-auth-custom-adapter for better type handling - Remove redundant comment in next-auth-options related to Azure AD email verification * remove log * remove debug log from signin callback in next-auth options * fixup * chore: standardize naming * chore: add primary calendar for outlook, verify email and auto link org for outlook * chore: helper fns * chore: implement cubic feedback * cleanup * chore: implement cubic feedback again * WIP design# * feat: login design * fix: map identity provider names correctly * 32px of mt * fix: login UI * fix: type check * fix: fix type check again * chore: update OAuth login tests * fixup * fix: bad import * chore: update tests * fixup * fix: locales test * chore: implement PR feedback and fix minor issues * fix: revert token spreading change * fix: merge conflicts * chore: revert signup view changes * fixup: bring back reverted changes because of merge conflicts * fix: disable email input when microsoft sign in is in progress * chore: implement cubic feedback * cleanup: unused variables * fix: address Cubic AI review feedback (confidence >= 9/10) - Remove userId (PII) from log payloads in updateProfilePhotoMicrosoft.ts - Replace text selectors with data-testid in locale.e2e.ts and oauth-provider.e2e.ts - Restore callbackUrl redirect parameter in signup link in login-view.tsx - Add data-testid='login-subtitle' to login page subtitle element Co-Authored-By: unknown <> * fix: use empty alt for decorative icon images in login view MicrosoftIcon and GoogleIcon are decorative (adjacent to text labels), so they should have empty alt attributes per accessibility best practices. Co-Authored-By: unknown <> * chore: implement cubic feedback * cleanup * fixup * chore: implement PR feedback * chore: implement feedback * fix: address PR review feedback - type safety and centralize constants - Replace non-null assertions (!) with proper null checks for OUTLOOK_CLIENT_ID/SECRET - Replace `as any` casting with `Record<string, unknown>` for OAuth profile claims - Remove non-null assertion on account.access_token by adding conditional check - Centralize Outlook env constants in @calcom/lib/constants alongside MICROSOFT_CALENDAR_SCOPES - Add explanatory comment for getNextAuthProviderName usage in get.handler.ts Co-Authored-By: unknown <> * Revert "fix: address PR review feedback - type safety and centralize constants" This reverts commit 91ace141e6a28a23deea5897f7f9d6ad80319d84. * chore: implement feedback * chore: cleanup * chore: implement feedback * fix: merge conflicts * fix: revert formatting-only changes in packages/lib/constants.ts Co-Authored-By: unknown <> * fix: revert IdentityProvider enum location change in schema.prisma Co-Authored-By: unknown <> * chore: implement more PR feedback * fix: restore database-derived profileId from determineProfile in OAuth JWT The profileId regression was identified by Cubic AI (confidence 9/10). Previously, determineProfile's returned id was used to set profileId in the JWT via 'profileResult.id ?? token.profileId ?? null'. A recent refactor changed this to 'token.profileId ?? null', which drops the database-derived profile ID. On first OAuth login (or when profile switcher is disabled), token.profileId is likely null, so profileId would incorrectly be set to null even though determineProfile returned a valid profile with an id. This commit restores the correct priority chain: visitorProfileId ?? token.profileId ?? null Co-Authored-By: bot_apk <apk@cognition.ai> * refactor: revert pure formatting and import reordering changes Co-Authored-By: rajiv@cal.com <sahalrajiv6900@gmail.com> * fix: normalize determineProfile return type to use consistent 'id' field The determineProfile function returned a union type where one branch used 'id' and the other used 'profileId'. This caused TS2339 when destructuring 'id' from the result. Normalize the token.upId branch to also return 'id' (mapped from token.profileId) so the return type is consistent. Co-Authored-By: bot_apk <apk@cognition.ai> * chore: add tests * reveret: profileId changes should be in a separate PR * fix: avoid logging entire existingUser object in OAuth JWT callback Revert to logging only { userId, upId } instead of the full existingUser object, which contains PII (email, name, identity provider details). This restores the previous safe logging pattern. Co-Authored-By: bot_apk <apk@cognition.ai> * chore: remove profileId related tests --------- Co-authored-by: amrit <iamamrit27@gmail.com> Co-authored-by: Devanshu Sharma <devanshusharma658@gmail.com> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Sean Brydon <sean@cal.com> Co-authored-by: bot_apk <apk@cognition.ai> |
||
|
|
5d65a0f091 |
fix: hide cal branding for orgs/teams (#27643)
* fix: hide branding for teams * fix: remove unused organizationId and username fields from profiles select Addresses Cubic AI review feedback (confidence 9/10) to select only the profile fields that are actually used. The organizationId and username fields were fetched but never referenced in this function. Co-Authored-By: unknown <> * fix: unit tests * fix: add prisma named export to test mock Co-Authored-By: rajiv@cal.com <sahalrajiv6900@gmail.com> * Add tests: packages/features/profile/lib/hideBranding.test.ts Generated by Paragon from proposal for PR #27643 * chore: implement cubic feedback * fix: merge conflicts * fix: unit tests * fixup * refactor: implement DI pattern for event type service * fix: atoms build --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> |
||
|
|
14c151be76 |
fix: add CSRF protection to OAuth callback via HMAC-signed nonce (#28083)
* fix: add CSRF protection to OAuth callback via HMAC-signed nonce The OAuth state parameter was used only for passing application data (returnTo, teamId) with no cryptographic binding to the user session. An attacker could authorize their own account on a provider, capture the authorization code, and trick a logged-in user into visiting the callback URL to link the attacker's account to the victim's Cal.com profile. Changes: - encodeOAuthState: generate a random nonce and HMAC-sign it with NEXTAUTH_SECRET + userId, injecting both into the OAuth state - decodeOAuthState: verify the HMAC on callback using timingSafeEqual; skip verification when nonce is absent (backwards compatible with apps that don't yet use encodeOAuthState) - Stripe callback: replace raw state.returnTo redirect with getSafeRedirectUrl to prevent open redirect, remove redundant getReturnToValueFromQueryState, add missing return on access_denied Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: make CSRF nonce verification mandatory with allowlist for exempt apps Makes nonce/HMAC verification mandatory by default in decodeOAuthState, preventing attackers from bypassing CSRF protection by omitting nonce fields from the state parameter. Apps not yet migrated to encodeOAuthState (stripe, basecamp3, dub, webex, tandem) are explicitly allowlisted and pass their slug to decodeOAuthState to skip verification. Addresses review feedback (identified by cubic) about the conditional check being trivially bypassable. Co-Authored-By: unknown <> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> |
||
|
|
12e95a1f47 |
feat: Add meta pixel conversion events (#25638)
* feat(meta-pixel): add trackingEvent to zod schema * fix: do not allow trackingEvent to be optional * feat(meta-pixel): add trackingEvent selection dropdown to UI * feat(meta-pixel): add trackingEvent to Event Type App Data * fix(meta-pixel): implement history API hook for SPA conversion tracking * fix(meta-pixel): check for cancel in URL and prevent Re-wrapping of pushState * Update EventTypeAppSettingsInterface.tsx * fix: make trackingEvent optional in zod schema to fix type-check --------- Co-authored-by: Sahitya Chandra <sahityajb@gmail.com> |
||
|
|
5d65df9c05 |
chore: migrate booking requested webhook trigger (#27546)
* init * wiring up * fix type * feat: implement DI pattern for webhook producer in API v2 - Export IWebhookProducerService and getWebhookProducer from platform-libraries - Add WEBHOOK_PRODUCER token and useFactory provider in RegularBookingModule - Inject webhookProducer in RegularBookingService and pass to base class This follows the composition root pattern where only the NestJS module knows about getWebhookProducer(), and all consumers depend only on the IWebhookProducerService interface via constructor injection. Co-Authored-By: ali@cal.com <alishahbaz7@gmail.com> * test: migrate BOOKING_REQUESTED tests to new webhook architecture - Remove failing BOOKING_REQUESTED tests from fresh-booking.test.ts (4 tests) - Remove failing BOOKING_REQUESTED tests from reschedule.test.ts (2 tests) - Remove failing BOOKING_REQUESTED test from collective-scheduling.test.ts (1 test) - Replace WebhookTaskConsumer.test.ts with placeholder (constructor changed) - Create new webhook architecture test suite: - producer/WebhookTaskerProducerService.test.ts (14 tests) - consumer/WebhookTaskConsumer.test.ts (8 tests) - consumer/triggers/booking-requested.test.ts (8 tests) The new test suite is organized by trigger type for extensibility as more triggers are migrated to the producer/consumer pattern. Co-Authored-By: ali@cal.com <alishahbaz7@gmail.com> * test: remove paid events BOOKING_REQUESTED test (moved to new architecture) Co-Authored-By: ali@cal.com <alishahbaz7@gmail.com> * wrap webhook in own try-catch * wire datafetcher * fix * fix v2 * fix circular dependency * -- * merge-conflict-resolve * mreg-conflict-resolve * remove early return * test: add integration tests for BOOKING_REQUESTED webhook producer invocation Cover all 8 scenarios verifying the booking flow correctly invokes the webhook producer for BOOKING_REQUESTED: 1. Basic confirmation → queueBookingRequestedWebhook called 2. Booker-is-organizer + confirmation → still called 3. Confirmation threshold NOT met → not called (BOOKING_CREATED instead) 4. Confirmation threshold IS met → called 5. Paid event + confirmation → called after payment succeeds 6. Reschedule + confirmation (non-organizer) → called (not BOOKING_RESCHEDULED) 7. Reschedule + confirmation (organizer) → not called (BOOKING_RESCHEDULED instead) 8. Collective scheduling + confirmation → called Adds reusable MockWebhookProducer helper in @calcom/testing for extendable use as more webhook triggers migrate to the new architecture. Co-Authored-By: ali@cal.com <alishahbaz7@gmail.com> * fix bug * fix conditional check * remove unnecessary comment * add missing expect * remove empty test * clean up * tasker config * -- * fix missing metadata * remove faulty if else * test: add payload content verification tests for BOOKING_REQUESTED webhook Co-Authored-By: ali@cal.com <alishahbaz7@gmail.com> * remove unnecessary tests --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Hariom Balhara <1780212+hariombalhara@users.noreply.github.com> |
||
|
|
3a7122d613 |
fix: revert assignmentReason breaking change in webhook payloads (#27891)
* fix: revert assignmentReason breaking change in webhook payloads
Remove the new { category, details } format from EventPayloadType to
maintain backward compatibility for webhook consumers. The new format
is stripped at all webhook payload construction sites by destructuring
assignmentReason out of CalendarEvent before spreading into the payload.
A sanitizeAssignmentReasonForWebhook function provides an additional
safety net in sendPayload itself. Emails and booking single view
continue to use the new format via CalendarEvent.
Co-Authored-By: ali@cal.com <alishahbaz7@gmail.com>
* fix: strip assignmentReason from handlePaymentSuccess webhook payload
Co-Authored-By: ali@cal.com <alishahbaz7@gmail.com>
* fix: strip assignmentReason from triggerWebhooks and handleSeats webhook payloads
Co-Authored-By: ali@cal.com <alishahbaz7@gmail.com>
* refactor: use zod safeParse instead of type assertion in sanitizeAssignmentReasonForWebhook
Co-Authored-By: ali@cal.com <alishahbaz7@gmail.com>
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
||
|
|
4a6d608b19 |
refactor: simplify link-as-an-app template and migrate 24 existing apps (#27215)
* refactor: simplify link-as-an-app template to config.json only - Remove api/, components/, index.ts, package.json from link-as-an-app template - Add externalLink field to AppMetaSchema for external URL configuration - Update API handler to dynamically create handlers for external link apps - External link apps no longer create credentials (just redirect to URL) - Update CLI to handle externalLinkUrl field for link-as-an-app template - CLI now skips package.json update for apps without package.json Co-Authored-By: peer@cal.com <peer@cal.com> * fix: simplify external link handler to bypass credential creation External link apps now directly return the redirect URL without going through the AppDeclarativeHandler type, avoiding type conflicts with the createCredential return type requirement. Co-Authored-By: peer@cal.com <peer@cal.com> * refactor: migrate 24 external link apps to simplified structure Migrated the following apps to use config.json with externalLink field instead of api/add.ts handlers: - amie, autocheckin, baa-for-hipaa, bolna, chatbase, clic, cron, deel - elevenlabs, fonio-ai, framer, granola, greetmate-ai, lindy, millis-ai - monobot, n8n, pipedream, raycast, retell-ai, synthflow, telli, vimcal - wordpress Each app now only contains: config.json, DESCRIPTION.md, static/ Removed: api/, components/, index.ts, package.json Co-Authored-By: peer@cal.com <peer@cal.com> * nit * Fix merge conflict issue * refactor: generate REDIRECT_APPS dynamically during app-store build - Add logic to build.ts to detect apps with externalLink field - Generate redirect-apps.generated.ts with list of redirect app slugs - Update redirectApps.ts to import from generated file - Revert [...]args].ts to original state (Flow 1 is preferred) Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * fix: cast REDIRECT_APPS to readonly string[] for includes check Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * Fix error with React * Take exteral link URL as input * deleted bun.lockb --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Hariom Balhara <hariombalhara@gmail.com> |
||
|
|
2c105aceb8 |
chore: convert console.log to debug log in raqbUtils (#27008)
## What does this PR do? Converts a `console.log` statement to use the proper `@calcom/lib/logger` with debug level in the raqbUtils.server.ts file. This ensures the log message only appears when debug logging is enabled, reducing noise in production logs. ## Mandatory Tasks (DO NOT REMOVE) - [x] I have self-reviewed the code (A decent size PR without self-review might be rejected). - [x] I have updated the developer docs in /docs if this PR makes changes that would require a [documentation change](https://cal.com/docs). N/A - no documentation changes needed. - [x] I confirm automated tests are in place that prove my fix is effective or that my feature works. N/A - logging change only. ## How should this be tested? This is a simple logging change. No specific testing required beyond CI passing. The log message "A group option found. Using all its sub-options instead" will now only appear when the logger level is set to debug (level 2 or lower via `NEXT_PUBLIC_LOGGER_LEVEL`). ## Checklist - [x] My code follows the style guidelines of this project - [x] I have checked if my changes generate no new warnings <!-- Link to Devin run: https://app.devin.ai/sessions/45d95cd7127541ffac96764f251ae1c9 --> <!-- Requested by: @hariombalhara --> |
||
|
|
ad137fbf9c |
chore: disable apps with missing required keys (#27012)
* ci(companion): add separate typecheck workflow to catch type errors This adds a new companion-typecheck.yml workflow that runs TypeScript type checking for the companion app. This would have caught the missing useEffect import issue in PR #26931. Changes: - Add new companion-typecheck.yml workflow file - Update pr.yml to call the new workflow when companion files change - Add typecheck-companion to the required jobs list Co-Authored-By: anik@cal.com <adhabal2002@gmail.com> * add lint checks * test * remove * update typecheck * address review * chore:- hide apps with missing required keys from app store * update * Delete packages/app-store/_utils/hasRequiredAppKeys.test.ts * Update validateAppKeys.ts * Update validateAppKeys.ts * Update validateAppKeys.test.ts --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> |
||
|
|
b584f0a9de |
chore: reduce log spam on Calendars (#26927)
* Remove Vercel warnings on deploy * reduce log noise |
||
|
|
3a8fe8c7af |
perf: convert services to factory functions and add TypeScript project references (#26117)
* perf(app-store): convert services to factory functions to narrow SDK type exports This change converts CRM, Calendar, Payment, and Analytics services from exporting classes to exporting factory functions that return interface types. This prevents SDK types (HubSpot, Stripe, etc.) from leaking into the type system when TypeScript emits .d.ts files. Services modified: - CRM: hubspot, salesforce, closecom, pipedrive-crm, zoho-bigin, zohocrm - Calendar: all 13 calendar services - Payment: stripe, paypal, alby, btcpayserver, hitpay, mock-payment-app - Analytics: dub Video adapters were audited and already use factory pattern. WIP: Salesforce CRM service has a type error that needs fixing. Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix(salesforce): add type assertion for appOptions in factory function Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix: update remaining consumers to use factory functions - getAnalytics.ts: call factory function instead of new - getConnectedApps.ts: call factory function instead of new - salesforce/CrmService.ts: fix type assertion with default value - salesforce/routingForm/incompleteBookingAction.ts: use factory function - salesforce/routingFormBookingFormHandler.ts: use factory function Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix(salesforce): add SalesforceCRM interface for Salesforce-specific methods - Create SalesforceCRM interface extending CRM with findUserEmailFromLookupField and incompleteBookingWriteToRecord methods - Add createSalesforceCrmServiceWithSalesforceType factory function for internal Salesforce modules - Update routing form files to use the new factory function with proper typing Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix(salesforce): correct return type in SalesforceCRM interface The findUserEmailFromLookupField method returns { email: string; recordType: RoutingReasons } | undefined, not string | undefined. Updated the interface to match the actual implementation. Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix: update all call sites to use factory functions - Update calendar API add files to use factory functions (7 files) - Update Google Calendar test files to use factory functions (3 files) - Update Salesforce test files to use SalesforceCRM interface - Add testMode parameter to createSalesforceCrmServiceWithSalesforceType - Remove unused @ts-expect-error directive in bookingScenario.ts Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix: add GoogleCalendar interface and update factory functions for service-specific methods Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix: add type annotation to attendee parameter in google-calendar.e2e.ts Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix: update selected-calendars/route.ts to use GoogleCalendar factory function Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix: update remaining GoogleCalendarService call sites to use factory function Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix: remove explicit type annotation in google-calendar.e2e.ts to fix type error Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix: update test mocks to use factory function pattern for calendar and payment services Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix: convert MockPaymentService to factory function in setupVitest.ts Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix(api-v2): call calendar service factory functions instead of using new Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * perf(trpc): add TypeScript project references to reduce build file count - Add tsconfig.build.json to app-store with composite settings for declaration emit - Add tsconfig.server.build.json to trpc with project references - Add types and typesVersions to app-store package.json to redirect type resolution to dist-types - Add build:types script to app-store for generating declarations - Add dist-types to .gitignore This reduces the tRPC build file count from 7,733 to 5,618 files (27% reduction) by having TypeScript resolve to prebuilt .d.ts files instead of source files. Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix(app-store): add fallback to typesVersions for CI compatibility The typesVersions now prefers dist-types but falls back to source files when dist-types don't exist. This fixes CI type-check failures while still allowing the optimization when dist-types are built. Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * Added build dependency for tRPC on app-store * fix(app-store): exclude test directories from tsconfig.build.json Exclude __tests__, __mocks__, and tests directories from the build config to prevent test utility files (which import from outside rootDir) from being included in the declaration emit. Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix(turbo): add build:types task definition for app-store Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix(turbo): remove circular build dependency between trpc and app-store The build:types task for app-store transitively imports from @calcom/features, which imports from @calcom/trpc. This creates a circular build dependency when @calcom/trpc#build depends on @calcom/app-store#build:types. Solution: Remove the turbo dependency. The typesVersions fallback pattern ['./dist-types/*', './*'] will use source files when dist-types/ doesn't exist, and use prebuilt declarations when they do exist (for faster builds). Also exclude dist-types from regular tsconfig.json to prevent 'Cannot write file' errors when dist-types/ exists. Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * refactor(app-store): rename dist-types to types for consistency Rename the prebuilt TypeScript declarations folder from dist-types to types to match the convention used by @calcom/trpc and other packages in the monorepo. Updated files: - tsconfig.build.json: declarationDir and exclude - tsconfig.json: exclude - package.json: typesVersions paths - turbo.json: build:types outputs - .gitignore: ignore path Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix(api-v2): update ICS calendar test to mock factory function instead of class prototype The IcsFeedCalendarService is now a factory function, not a class, so jest.spyOn(IcsFeedCalendarService.prototype, 'listCalendars') no longer works. Updated to use jest.spyOn(appStore, 'IcsFeedCalendarService').mockImplementation() to mock the factory function return value instead. Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * refactor(app-store): rename factory functions to Build* naming convention - Rename Calendar factory functions from create*CalendarService to BuildCalendarService - Rename CRM factory functions from create*CrmService to BuildCrmService - Rename Payment factory functions from PaymentService to BuildPaymentService - Rename Analytics factory function from createDubAnalyticsService to BuildAnalyticsService - Update all index.ts re-exports to use new names - Update all call sites throughout the codebase - Update test mocks to use new factory function names This makes it clear that these are factory functions, not class constructors. Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix(app-store): update remaining CalendarService and PaymentService imports to Build* names - Update api/add.ts files for applecalendar, caldavcalendar, exchange2013calendar, exchange2016calendar, exchangecalendar, ics-feedcalendar - Update mock-payment-app index.ts to export BuildPaymentService - Fix googlecalendar test import alias for createInMemoryDelegationCredentialForBuildCalendarService Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix(tests): update payment service mocks to use BuildPaymentService - Update setupVitest.ts to use BuildPaymentService instead of PaymentService - Update handlePayment.test.ts mock to use BuildPaymentService Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * refactor: address PR review comments - rename to Build* and remove unused code Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * refactor: remove explanatory comments and fix indentation Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * chore: update .gitignore to use *.tsbuildinfo pattern Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix(api-v2): update IcsFeedCalendarService to BuildIcsFeedCalendarService in e2e test Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * style: format CalendarService.test.ts Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * Delete apps/ui-playground/next-env.d.ts --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> |
||
|
|
cfbcd0f95b |
chore: upgrade sentry and start using metrics for Calendar Cache (#26827)
* upgrade sentry and start using metrics * format changes * format changes * format changes * type error * type error * format changes * format changes * fix: add updateSyncStatus call on API error and mock Sentry metrics in tests Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> |
||
|
|
77f59b1e4d |
chore: Integrate confirmation booking audit (#26523)
* chore: Integrate booking confirmation booking audit Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * fix: Use BookingStatus type instead of string for booking.status Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * Make booking-audit integration test utils reusable * refactor: enhance handlePaymentSuccess to accept appSlug and actor identification - Updated handlePaymentSuccess function to accept an object with paymentId, bookingId, appSlug, and traceContext. - Introduced getActor function to determine the actor based on appSlug and credentialId. - Modified webhook handlers for Alby, BTCPayServer, HitPay, PayPal, and Stripe to pass the new parameters. - Improved logging for missing credentialId in payment processing. - Adjusted related schemas to ensure proper type handling for booking status and actor identification. * fix: Correct import paths and getActor function call Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * fix: Use ActorIdentification type instead of AuditActor in getActor Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * fix: Add guard clause for undefined actor in fireBookingAcceptedEvent Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * fix: Add actionSource to all confirm calls Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * refactor: Integrate actor identification and action source updates across booking services - Added `makeUserActor` to various booking service files to enhance actor identification. - Updated action source handling in booking confirmation and related functions to include "MAGIC_LINK". - Refactored schemas to accommodate new actor and action source requirements, ensuring consistent type handling. - Improved error handling and logging for booking actions to enhance traceability. * Remvoe formatting changes * Add test * refactor: Enhance booking confirmation tests and event handling - Updated `confirm.handler.test.ts` to improve test coverage for booking acceptance and rejection scenarios, including bulk bookings. - Refactored the mock implementation of `BookingEventHandlerService` to streamline event handling for accepted and rejected bookings. - Adjusted the `handleConfirmation` function to utilize `acceptedBookings` for better clarity and maintainability. - Added tests to ensure correct invocation of event handler methods for both single and bulk booking confirmations and rejections. * fix tests * refactor: Use confirmHandler directly in link and verify-booking-token routes Refactors the link and verify-booking-token API routes to call confirmHandler directly instead of using the tRPC caller pattern. This simplifies the code by removing the need for session getter, legacy request building, and context creation. Changes: - apps/web/app/api/link/route.ts: Use confirmHandler directly with ctx and input - apps/web/app/api/verify-booking-token/route.ts: Use confirmHandler directly with ctx and input - Updated tests to mock confirmHandler instead of tRPC caller Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * fix ts errors due to merge frommain * feat: introduce getAppActor utility for actor creation This commit adds a new utility function, getAppActor, to streamline the process of creating actor objects for apps based on their slug and credential ID. The function is integrated into handlePaymentSuccess and handleStripePaymentSuccess, replacing the previous inline actor creation logic. This refactor enhances code maintainability and readability by centralizing actor creation logic. Changes: - New file: packages/app-store/_utils/getAppActor.ts - Updated handlePaymentSuccess and handleStripePaymentSuccess to use getAppActor - Removed redundant actor creation code from these functions * refactor: Update appSlug in payment success handlers to use appConfig.slug This commit modifies the appSlug parameter in the handlePaymentSuccess function across multiple payment webhook handlers to utilize the appConfig.slug value instead of hardcoded strings. This change enhances consistency and maintainability of the code. Changes: - Updated appSlug in handlePaymentSuccess for btcpayserver, hitpay, and paypal webhooks. - Adjusted a test case to reflect the new appSlug value for consistency. * test: Enhance booking token verification and audit action tests This commit adds additional assertions to the booking token verification tests to ensure that the confirmHandler is not called when an error occurs. It also introduces a mechanism to clean up additional booking UIDs after each test in the accepted action integration tests, improving test reliability. Furthermore, it updates the action source schema comment for clarity. Changes: - Updated tests in `verify-booking-token` to check that `mockConfirmHandler` is not called on error. - Implemented cleanup logic for additional booking UIDs in `accepted-action.integration-test.ts`. - Clarified comment in `actionSource.ts` regarding the schema for action sources. - Refactored `handleConfirmation.ts` and `confirm.handler.ts` to include tracing logger for error handling in booking events. --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> |
||
|
|
7a6f4b2594 |
fix: add global CRM services mock to prevent test flakes (#26716)
* fix: mock CRM services to prevent test flakes in handlePaymentSuccess.test.ts Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * fix: add global CRM services mock to prevent test flakes The test flakes were caused by the Salesforce CRM service importing @urql/core, which triggers fetch calls during module loading. These fetch calls remain pending when the Vitest worker shuts down, causing the error: '[vitest-worker]: Closing rpc while fetch was pending' This fix adds a global mock for CrmServiceMap in setupVitest.ts, similar to how payment services are already mocked. This prevents the Salesforce module from being loaded during test execution. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> |
||
|
|
a62eb2bdac |
refactor: replace shouldServeCache with mode parameter for calendar cache control (#26539)
* refactor: replace shouldServeCache with mode parameter for calendar cache control Replace the boolean shouldServeCache parameter with a new CalendarFetchMode type that can have values 'slots', 'overlay', and 'booking'. This provides better control over when to serve cache vs relay on calendar providers. - 'slots' mode: Check feature flags and use cache when available (for getting actual calendar availability) - 'overlay' mode: Don't use cache (for overlay calendar availability) - 'booking' mode: Don't use cache (for booking confirmation) - undefined: Same as 'slots' for backwards compatibility The cache decision logic is now centralized in getCalendar.ts based on the mode parameter. Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * fix: update CalendarService.test.ts to use mode parameter Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * refactor: use shared GetAvailabilityParams type across all calendar services - Import GetAvailabilityParams and GetAvailabilityWithTimeZonesParams from @calcom/types/Calendar - Replace inline type definitions with shared types in all calendar service implementations - Update BaseCalendarService, CalendarCacheWrapper, and CalendarTelemetryWrapper - Ensures consistent typing and follows DRY principles Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * fix: add missing IntegrationCalendar import and update mock getAvailability signature - Add IntegrationCalendar back to sendgrid CalendarService imports - Update bookingScenario mock getAvailability to use typed params object - Add listCalendars method to mock Calendar object Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * fix: update test files to use typed params object for getAvailability methods - Update CalendarCacheWrapper.test.ts to call getAvailability/getAvailabilityWithTimeZones with params object - Update getCalendarsEvents.test.ts toHaveBeenCalledWith assertions to expect params object - All 32 tests now pass Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * refactor: consolidate to single GetAvailabilityParams type for both getAvailability methods - Remove GetAvailabilityWithTimeZonesParams, use GetAvailabilityParams for both methods - Add mode parameter to getAvailabilityWithTimeZones calls - Update wrapper classes to pass mode through to underlying calendar - Update test files to include mode in getAvailabilityWithTimeZones calls and assertions Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * refactor: use EventBusyDate with optional timeZone for getAvailabilityWithTimeZones - Add optional timeZone field to EventBusyDate type - Update getAvailabilityWithTimeZones return type to use EventBusyDate[] - Update Google Calendar service and wrapper classes to use the new type Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * fix: type errors and remove unused calendar watching methods - Fix type errors in CalendarCacheWrapper.ts (convert null to undefined for timeZone) - Fix type errors in getCalendarsEvents.ts (ensure timeZone is always present) - Remove unused watchCalendar/unwatchCalendar from Calendar interface - Remove unused startWatchingCalendarsInGoogle/stopWatchingCalendarsInGoogle from GoogleCalendarService - Remove unused imports (uuid, uniqueBy, GOOGLE_WEBHOOK_URL, ONE_MONTH_IN_MS) Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * fix: remove watchCalendar/unwatchCalendar from CalendarTelemetryWrapper Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * refactor: remove verbose JSDoc param comments from wrapper classes Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * refactor: make mode parameter required in getCalendar Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * fix: add required mode parameter to all getCalendar callers Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * fix: provide default mode value in getBusyCalendarTimes Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * fix: add mode parameter to remaining getCalendar callers Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * fix: add mode parameter to vital and wipemycalother reschedule Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * fix: add mode parameter to credential-sync API endpoint Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * refactor: add 'none' mode to CalendarFetchMode and use as default Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * test: add mode parameter to getCalendarsEvents test calls Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * Update packages/app-store/delegationCredential.ts Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com> |
||
|
|
f5d345b133 |
refactor: remove @calcom/web imports from @calcom/features and add @calcom/testing package (#26480)
* fix: remove @calcom/web imports from packages/features to eliminate circular dependency - Migrate UserTableUser and MemberPermissions types to packages/features/users/types/user-table.ts - Migrate useGeo hook to packages/features/geo/GeoContext.tsx - Migrate buildLegacyRequest to packages/lib/buildLegacyCtx.ts - Migrate Calendar component to packages/features/calendars/weeklyview/components/ - Move test utilities (bookingScenario, fixtures) to packages/features/test/ - Update all imports in packages/features to use new locations - Add re-exports in apps/web for backward compatibility Co-Authored-By: benny@cal.com <sldisek783@gmail.com> * fix: delete original implementation files and fix type issues - Delete original calendar component files in apps/web (keep only re-export stubs) - Migrate OutOfOfficeInSlots to packages/features/bookings/components - Convert apps/web OutOfOfficeInSlots to re-export stub - Fix className vs class issue in Calendar.tsx - Fix @calcom/trpc import violation in user-table.ts by using structural type Co-Authored-By: benny@cal.com <sldisek783@gmail.com> * fix: add missing isGroup and contains fields to UserTableUser attributes type Co-Authored-By: benny@cal.com <sldisek783@gmail.com> * fix: update customRole type to match actual Prisma Role model Co-Authored-By: benny@cal.com <sldisek783@gmail.com> * fix build * fix * fix * cleanup weeklyview * fix * refactor to mv MemberPermissions to types package * add types dependency to features * fix * fix * fix * fix * fix * fix * rename * rename * migrate * migrate * migrate * fix * fix * fix * refactor: move test utilities from packages/features/test to tests/libs - Move bookingScenario utilities to tests/libs/bookingScenario - Move fixtures to tests/libs/fixtures - Update all imports in packages/features test files to use new location - Update all imports in apps/web test files to use new location - Eliminates duplication of test utilities between packages/features and apps/web Co-Authored-By: benny@cal.com <sldisek783@gmail.com> * fix: correct relative import paths for tests/libs in test files Co-Authored-By: benny@cal.com <sldisek783@gmail.com> * refactor: replace test utility implementations with re-exports to tests/libs Co-Authored-By: benny@cal.com <sldisek783@gmail.com> * fix: fix test import paths and move signup handler tests to apps/web Co-Authored-By: benny@cal.com <sldisek783@gmail.com> * fix: move buildLegacyCtx to packages/lib and restore handlers to packages/features - Move buildLegacyCtx from apps/web/lib to packages/lib to break circular dependency - Update apps/web/lib/buildLegacyCtx.ts to re-export from @calcom/lib - Restore signup handlers and tests to packages/features/auth/signup/handlers - Update handler imports to use @calcom/lib/buildLegacyCtx instead of @calcom/web/lib/buildLegacyCtx Co-Authored-By: benny@cal.com <sldisek783@gmail.com> * fix: update recurring-event.test.ts imports to use tests/libs path Co-Authored-By: benny@cal.com <sldisek783@gmail.com> * refactor: delete test re-export files and update imports to use tests/libs directly Co-Authored-By: benny@cal.com <sldisek783@gmail.com> * fix: update remaining test imports to use tests/libs directly Co-Authored-By: benny@cal.com <sldisek783@gmail.com> * fix: update handleRecurringEventBooking calls to match function signature (1 arg) Co-Authored-By: benny@cal.com <sldisek783@gmail.com> * remove * migrate tests * migrate tests * refactor: update test mock imports by removing and using async for mock creators. * fix type errors * fix: add type assertion for MockUser in p2002.test-suite.ts Co-Authored-By: benny@cal.com <sldisek783@gmail.com> * fix: restore locale import in compareReminderBodyToTemplate.test.ts using relative path Co-Authored-By: benny@cal.com <sldisek783@gmail.com> * feat: create @calcom/testing package and migrate tests from /tests directory - Created new @calcom/testing package in /packages/testing - Moved all files from /tests to /packages/testing - Updated all imports across the codebase to use @calcom/testing alias - Removed /tests directory at root level This allows other packages like @calcom/features and @calcom/web to import testing utilities using the @calcom/testing alias instead of relative paths. Co-Authored-By: benny@cal.com <sldisek783@gmail.com> * fix * fix * fix: add missing useBookings export to @calcom/atoms package Co-Authored-By: benny@cal.com <sldisek783@gmail.com> * fix: add missing useCalendarsBusyTimes and useConnectedCalendars exports to @calcom/atoms Co-Authored-By: benny@cal.com <sldisek783@gmail.com> * chore: add @calcom/testing as explicit devDependency to packages that use it Co-Authored-By: benny@cal.com <sldisek783@gmail.com> * refactor: move setupVitest.ts into @calcom/testing package Co-Authored-By: benny@cal.com <sldisek783@gmail.com> * fix * chore: add biome rules to restrict @calcom/testing imports Co-Authored-By: benny@cal.com <sldisek783@gmail.com> * fix * rename libs to lib * rename libs to lib * add rule * add rule * refactor: remove @calcom/features imports from @calcom/testing - Move mockPaymentSuccessWebhookFromStripe to fresh-booking.test.ts - Replace ProfileRepository.generateProfileUid() with uuidv4() - Clone Tracking type into @calcom/testing/src/lib/types.ts - Update imports in expects.ts and getMockRequestDataForBooking.ts - Move source files into src/ folder - Move CalendarManager mock to @calcom/features Co-Authored-By: benny@cal.com <sldisek783@gmail.com> * fix: add explicit exports for nested paths in @calcom/testing Co-Authored-By: benny@cal.com <sldisek783@gmail.com> * improve * improve * fix * fix * fix type checks * fix type checks * fix type checks * fix tests --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> |
||
|
|
f54a3d1d0c | test: all flaky unit tests (#26558) | ||
|
|
4585d7402d |
fix: BOOKING_PAID webhook & workflow isn't triggering after payment successful (#26044)
* fix booking paid webhook * Update handlePaymentSuccess to include updatedBooking status * Fix videoCallUrl undefined error in BOOKING_PAID workflow trigger - Import getVideoCallUrlFromCalEvent to properly compute meeting URL - Use conditional metadata to avoid passing undefined videoCallUrl - Matches original handleConfirmation.ts behavior Co-Authored-By: anik@cal.com <adhabal2002@gmail.com> * Add missing schedulingType to calendarEventForWorkflow - Added schedulingType field to match original handleConfirmation.ts behavior - This field was present in the original implementation but missing in the refactor Co-Authored-By: anik@cal.com <adhabal2002@gmail.com> * Fix paymentMetadata nullability to match original behavior - Changed from ?? null to optional chaining (undefined) to match original handleConfirmation.ts - This ensures webhook consumers using z.string().optional() schemas continue to work - undefined values are omitted from JSON, while null values would be explicitly included Co-Authored-By: anik@cal.com <adhabal2002@gmail.com> * Fix type errors: add schedulingType to getBooking and use null for metadata - Added schedulingType to getBooking.ts eventType select to make it available - Changed paymentMetadata to use ?? null instead of undefined for type compatibility - The metadata type expects { [key: string]: string | number | boolean | null } Co-Authored-By: anik@cal.com <adhabal2002@gmail.com> * await * add tests --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> |
||
|
|
4571215794 |
feat(calendar-subscription): add telemetry metrics for cache performance and webhook calls (#26501)
* feat(calendar-subscription): add telemetry metrics for cache performance and webhook calls - Add Sentry span telemetry to CalendarCacheWrapper.getAvailability() and getAvailabilityWithTimeZones() to measure: - Cache fetch duration (cacheFetchDurationMs) - Original calendar fetch duration (originalFetchDurationMs) - Number of calendars from cache vs original source - Number of events from each source - Whether cache was used (cacheUsed) - Add Sentry span telemetry to CalendarSubscriptionService.processWebhook() to track: - Provider (google_calendar, office365_calendar) - Success/failure status - Processing duration (durationMs) - Error messages on failure - Channel ID and selected calendar ID - Create telemetry module with types, sentry-span, and no-op-span implementations Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * refactor(calendar-subscription): move telemetry to @calcom/lib for reusability - Add withSpan helper to @calcom/lib/sentryWrapper for reusable telemetry - Update CalendarCacheWrapper to use withSpan from @calcom/lib - Update CalendarTelemetryWrapper to use withSpan from @calcom/lib - Update CalendarSubscriptionService to use withSpan from @calcom/lib - Remove old telemetry module from calendar-subscription feature - Add telemetry tracking when cache is disabled for performance comparison Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * fix(calendar-subscription): only apply telemetry wrapper when Sentry is configured - Fix unit test failures by checking if Sentry is configured before wrapping - Remove ESLint inline rules from getCalendar.ts Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * refactor(calendar-subscription): move CalendarTelemetryWrapper to telemetry directory - Move CalendarTelemetryWrapper from cache/ to telemetry/ directory - Update import path in getCalendar.ts Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * feat(telemetry): add console fallback when Sentry is not configured - Add console logging fallback in development mode when Sentry is not configured - Create isTelemetryEnabled() helper to check if telemetry should be enabled - Update getCalendar.ts to use isTelemetryEnabled() helper - Logs span name, operation, duration, and attributes to console via @calcom/lib/logger Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * refactor(calendar-subscription): wrap all calendars with CalendarTelemetryWrapper - CalendarTelemetryWrapper now wraps ALL cache-supported calendars with cacheEnabled parameter - CalendarCacheWrapper keeps cache-specific metrics with distinct op (calendar.cache.internal.*) - CalendarTelemetryWrapper uses canonical op (calendar.getAvailability) for consistent querying - Nested spans: outer telemetry wrapper measures end-to-end, inner cache wrapper measures cache internals Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> |
||
|
|
87cf3210dc |
feat: queue or cancel payment reminder flow (#24889)
Co-authored-by: Pallav <90088723+Pallava-Joshi@users.noreply.github.com> Co-authored-by: Ryukemeister <sahalrajiv6900@gmail.com> Co-authored-by: Rajiv Sahal <sahalrajiv-extc@atharvacoe.ac.in> Co-authored-by: Peer Richelsen <peeroke@gmail.com> |
||
|
|
bbf9274d37 |
chore: upgrade Vitest to 4.0.16 and Vite to 6.4.1 (#26351)
* chore: upgrade Vitest to 4.0.16 and Vite to 6.4.1 - Update vitest from 2.1.9 to 4.0.16 - Update @vitest/ui from 2.1.9 to 4.0.16 - Update vitest-fetch-mock from 0.3.0 to 0.4.5 - Update vitest-mock-extended from 2.0.2 to 3.1.0 - Update vite from 4.5.14/5.4.21 to 6.4.1 across all packages - Update @vitejs/plugin-react to 5.1.2 - Update @vitejs/plugin-react-swc to 4.2.2 - Update @vitejs/plugin-basic-ssl to 2.1.0 - Update vite-plugin-dts to 4.5.4 - Rename vitest.config.ts to vitest.config.mts for ESM compatibility - Add globals: true to vitest config Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * fix: address Vitest 4.0 and Vite 6 breaking changes - Convert arrow function mockImplementation patterns to regular functions (Vitest 4.0 breaking change: arrow functions can't be constructor mocks) - Fix CSS imports with ?inline suffix for Vite 6 compatibility - Add biome override to disable useArrowFunction rule for test files - Fix syntax errors in test files introduced by regex replacements Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * fix: fix remaining Vitest 4.0 constructor mock patterns Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * fix: fix more Vitest 4.0 constructor mock patterns and exclude API v2 spec files Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * fix: convert more arrow function mocks to regular functions for Vitest 4.0 Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * fix: convert more arrow function mocks to regular functions for Vitest 4.0 - Fix CrmService.integration.test.ts jsforce.Connection mock - Fix RetellSDKClient.test.ts Retell mock - Fix RetellAIService.test.ts CreditService mocks - Fix GoogleCalendarSubscriptionAdapter.test.ts CalendarAuth mock Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * fix: convert Google Calendar and OAuthManager arrow function mocks for Vitest 4.0 - Fix googleapis.ts Calendar, OAuth2Client, and JWT mocks - Fix utils.ts JWT mock - Fix OAuthManager.ts defaultMockOAuthManager mock Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * fix: add React plugin, jsdom environment, and fix more constructor mocks for Vitest 4.0 Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * fix: convert HostRepository PrismaClient mock to regular function for Vitest 4.0 Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * fix: add useOrgBranding mock to React component tests for Vitest 4.0 Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * fix: update TestFunction type for Vitest 4.0 compatibility Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * fix: convert listBookingReports constructor mocks to regular functions for Vitest 4.0 Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * fix: convert UserRepository constructor mock to regular function for Vitest 4.0 Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * fix: convert OrganizationPaymentService constructor mock to regular function for Vitest 4.0 Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * fix: convert more constructor mocks to regular functions for Vitest 4.0 Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * fix: add apps/web path aliases to vitest config Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * fix: fix test issues for Vitest 4.0 compatibility - Fix Response constructor 204 status code issue in testUtils.ts - Fix FeaturesRepository mock persistence in handleNotificationWhenNoSlots.test.ts - Add @vitest-environment node directive to formSubmissionUtils.test.ts - Fix document.querySelector mock in embed.test.ts Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * fix: clear EventManager spy between tests for Vitest 4.0 compatibility Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * fix: update TeamRepository mock pattern for Vitest 4.0 compatibility Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * fix: convert RoutingFormResponseRepository mock to regular function for Vitest 4.0 Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * fix: convert more constructor mocks to regular functions for Vitest 4.0 Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * fix: fix mock reset and spy clear issues for Vitest 4.0 Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * fix: fix remaining test failures for Vitest 4.0 upgrade - Fix booking-validations.test.ts: convert UserRepository mock to regular function - Fix route.test.ts: update 500 error test to mock ImageResponse instead of fetch - Fix users-public-view.test.tsx: add missing mocks for getOrgFullOrigin and useRouterQuery - Add @calcom/web path alias to vitest config Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * fix: add vitest-mocks for generated files that don't exist in CI - Add svg-hashes.json mock for route.test.ts - Add tailwind.generated.css mock for embed.test.ts - Update vitest config to use mock files Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * fix: update vitest config aliases for CI compatibility - Use array format for aliases to ensure proper ordering - Add @calcom/platform-constants alias to resolve from source - Add @calcom/embed-react alias to resolve from source - Ensure svg-hashes.json mock alias is matched before @calcom/web Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * fix: add @calcom/embed-snippet alias for CI compatibility Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * Fix wrong test * fix: migrate from CLI flags to VITEST_MODE env var for Vitest 4.0 Vitest 4.0 no longer allows custom CLI flags like --packaged-embed-tests-only. This change migrates to using VITEST_MODE environment variable instead: - VITEST_MODE=packaged-embed for packaged embed tests - VITEST_MODE=integration for integration tests - VITEST_MODE=timezone for timezone-dependent tests Updated vitest.config.mts to handle mode-based include/exclude patterns. Updated CI workflows and package scripts to use the new env var approach. Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * fix: return default include pattern instead of undefined in vitest config The getTestInclude() function was returning undefined for the default case, but Vitest 4.0 expects an array. This caused 'resolved.include is not iterable' error in CI. Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * fix: always set INTEGRATION_TEST_MODE for jsdom environment The getBookingFields.ts file checks for INTEGRATION_TEST_MODE to allow server-side imports in the jsdom environment. Without this, tests fail with 'getBookingFields must not be imported on the client side' error. Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * fix: support legacy CLI flags for backwards compatibility with main workflow The CI runs workflows from main branch, which uses the old CLI flag approach (yarn test -- --integrationTestsOnly). This commit adds backwards compatibility by checking both VITEST_MODE env var and process.argv for the legacy flags. Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> |
||
|
|
00e5770273 |
refactor: Move attribute and routing-forms code from app-store/lib to features (#26025)
* mv * wip * wip * wip * wip * plural * fix: resolve TypeScript type errors for attribute refactoring - Add TransformedAttributeOption type to handle transformed contains field - Update imports to use routing-forms Attribute type where needed - Fix getValueOfAttributeOption to use TransformedAttributeOption type - Update AttributeOptionValueWithType to use TransformedAttributeOption - Fix pre-existing lint warnings (any -> unknown, proper type casting) Co-Authored-By: benny@cal.com <sldisek783@gmail.com> * fix * cleanup * cleanup * fix * fix * fix * fix * fix * fix: add explicit type annotation to reduce callback in getAttributes.ts Co-Authored-By: benny@cal.com <sldisek783@gmail.com> * fix: use RouterOutputs from @calcom/trpc/react for consistent type inference - Update AppPage.tsx to use RouterOutputs from @calcom/trpc/react instead of inferRouterOutputs<AppRouter> - Update MultiDisconnectIntegration.tsx to use the same RouterOutputs type source - Add eslint-disable comments for pre-existing warnings (useEffect deps, img elements) Co-Authored-By: benny@cal.com <sldisek783@gmail.com> * fix: explicitly type attribute property in AttributeOptionAssignment The attribute property from Pick<AttributeOption, 'attribute'> was typed as 'unknown' because Prisma relations don't have explicit types when picked. This explicitly defines the attribute shape with id, type, and isLocked properties that are used in assignValueToUser.ts. Co-Authored-By: benny@cal.com <sldisek783@gmail.com> * fix: remove unused assignedUsers from AttributeOptionAssignment Pick The assignedUsers property was not being used in the code but was required by the Pick type, causing a type mismatch when the actual data from the database query didn't include it. Co-Authored-By: benny@cal.com <sldisek783@gmail.com> * fix: update import path for AttributeOptionAssignment and BulkAttributeAssigner types The types.d.ts file was moved from packages/lib/service/attribute/ to packages/app-store/routing-forms/types/. Updated the import path in utils.ts to point to the new location. Co-Authored-By: benny@cal.com <sldisek783@gmail.com> * fix --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> |
||
|
|
7f59a1f058 |
Revert "perf: (googlecalendar): batch freebusy calls by delegation credential (#24331)"
This reverts commit
|
||
|
|
ee6989a575 |
refactor: split raqbUtils into server and client modules to fix RAQB import in server context (#26112)
* refactor: add server and client raqbUtils modules Add two new modules to split RAQB utilities: - raqbUtils.server.ts: Server-safe utilities without RAQB runtime - raqbUtils.client.ts: Client-only utilities requiring RAQB runtime This enables server-side code to import RAQB utilities without pulling in the react-awesome-query-builder runtime library. Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * refactor: update imports to use server/client raqbUtils modules and fix lint warnings Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * fix: fix type errors in getLuckyUser.ts and remove dead code in RouteBuilder.tsx Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> |
||
|
|
51bce6763f |
refactor: split tRPC build into server and react phases (#26082)
* refactor: import AppRouter from generated types instead of server source This change improves tRPC build performance by having the client-side code import AppRouter from pre-generated type declarations instead of traversing the entire server router tree. Changes: - Create type bridge file at packages/trpc/types/app-router.ts - Update packages/trpc/react/trpc.ts to import from the bridge - Update .gitignore to only ignore types/server (generated files) - Update eslint.config.mjs to only ignore types/server (generated files) The type bridge provides: 1. Faster typechecking - avoids parsing 458 server files 2. Stable import location that's easy to lint against 3. Single place to adjust if generated path changes Build order is already enforced in turbo.json (type-check depends on @calcom/trpc#build). Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix: move bridge file to react/ to avoid TS5055 error Move the AppRouter type bridge file from types/app-router.ts to react/app-router.ts to avoid the TS5055 'Cannot write file because it would overwrite input file' error. The issue was that placing the bridge file in types/ caused TypeScript to treat the generated .d.ts files as input files during the tRPC build, then fail when trying to emit to the same location. By placing the bridge in react/ (which is excluded from the tRPC server build), the bridge file is only used by client code and doesn't interfere with the server type generation. Changes: - Move bridge file from types/app-router.ts to react/app-router.ts - Update import in react/trpc.ts to use ./app-router - Revert .gitignore to ignore all of types/ (generated files) - Revert eslint.config.mjs to ignore all of types/** Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * refactor: split tRPC build into server and react phases - Create tsconfig.server.json for server-only type generation - Create tsconfig.react.json for react/client type generation - Update build script to run server build first, then react build - Remove || true so build properly fails on errors - This allows react code to import from generated server types Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * refactor: split @calcom/trpc exports to separate server and react entrypoints - Remove react exports from @calcom/trpc root (index.ts) - Update 89 files to import from @calcom/trpc/react instead of @calcom/trpc - This fixes the boundary leak where server builds were pulling in react code - Server build no longer compiles react/app-router.ts, fixing the chicken-and-egg issue where react code needed generated server types that didn't exist yet This improves TypeScript build performance by preventing the server type generation from traversing the entire react/client type graph. Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix: import WorkflowType from lib/types instead of React component This fixes a boundary leak where the server build was pulling in React components through the WorkflowRepository import chain. By importing WorkflowListType from lib/types instead of WorkflowListPage.tsx, the server build no longer traverses React component files. Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix: extract server-safe types to prevent boundary leaks in tRPC build - Extract ChildrenEventType to lib/childrenEventType.ts (server-safe) - Extract Slots type to calendars/lib/slots.ts (server-safe) - Create types.server.ts files for eventtypes and bookings - Update server code to import from server-safe type files - Update DatePicker.tsx to use extracted Slots type - Update app-store utils to use BookerEventForAppData type This prevents the server build from pulling in React files through transitive imports from @calcom/features barrel exports. Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix: update Segment.test.tsx mock path to @calcom/trpc/react The test was mocking @calcom/trpc but importing from @calcom/trpc/react. After the entrypoint separation, the mock path needs to match the import path. Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix: temporarily restore || true to unblock PR merge The pre-existing Prisma type errors (~345 errors) will be addressed in a follow-up PR. This allows the two-phase build architecture changes to be merged first. Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * Run trpc build as part of API v2 build * Removed the bridge file * refactor: extract event type schemas to server-safe file - Create packages/features/eventtypes/lib/schemas.ts with createEventTypeInput and EventTypeDuplicateInput - Update types.ts to re-export schemas from the new server-safe location - Update tRPC schema files to import from schemas.ts instead of types.server.ts - Delete types.server.ts (was duplicating ~200 lines unnecessarily) This keeps the server build graph clean while avoiding code duplication. Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * Removed the optionality of the tRPC builds * Removed the extra command for API v2 * refactor: rename calendars/lib/slots.ts to types.ts Per Keith's feedback, renamed the file to types.ts since it contains type definitions. Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * Added back tRPC build:server for API v2 --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Dhairyashil Shinde <93669429+dhairyashiil@users.noreply.github.com> |
||
|
|
253c33df33 |
perf: (googlecalendar): batch freebusy calls by delegation credential (#24332)
* perf(googlecalendar): batch freebusy calls by delegation credential - Group selectedCalendars by delegationCredentialId before making API calls - Make one batched freebusy query per delegation credential group - Reduces total API calls while respecting credential boundaries - Maintains existing caching behavior per group - Updated both getAvailability and getAvailabilityWithTimeZones methods - Added groupCalendarsByDelegationCredential helper method - Handles edge case when no calendars provided but fallbackToPrimary is true - Fixed linting issue: replaced hasOwnProperty with 'in' operator Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * test(googlecalendar): add test for delegation credential batching - Verify calendars are grouped by delegationCredentialId - Ensure exactly 3 API calls made for 3 delegation credential groups - Confirm all busy times from different groups are properly returned - Fix type-safety issues by replacing 'as any' with proper type constraints - Fix ESLint warnings: unused variables and any types in mock functions Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * fix(googlecalendar): ensure fallback logic works with empty calendar groups - Handle empty calendar groups by ensuring at least one iteration - Add test for chunking groups larger than 50 calendars - Verify all delegation credential batching logic works correctly Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * fix: fix remaining type errors from merge conflict resolution - Changed getCacheOrFetchAvailability to getFreeBusyData in getAvailabilityWithTimeZones - Removed orphaned merge conflict marker in test file Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * fix: reset test file to original PR version and update method name - Reset CalendarService.test.ts to original PR version (0e9eb9e97a) - Updated getCacheOrFetchAvailability to getFreeBusyData to match main branch Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * fix: reset test file to main branch version The original PR's test file had tests for caching features that have been removed from main. Reset to main's version to fix type errors. Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * test(googlecalendar): add tests for delegation credential batching logic Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * Revamp devin's implementation * Remove comsoles.log * fix(tests): update delegation credential batching tests to match reimplementation - Remove tests for private methods that no longer exist (groupCalendarsByDelegationCredential, chunkArray) - Update getAvailability test to verify calendar fetching without expecting multiple API calls per delegation credential - Keep existing tests for fallback to primary calendar and non-google calendar handling Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * Remove dead code * improve documentation * docs: add README explaining Google Calendar availability batching feature Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * docs: translate README to English Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * docs: move README to calendar-batch package with comprehensive documentation - Remove README from googlecalendar lib (wrong location) - Add comprehensive README to packages/features/calendar-batch/ - Document CalendarBatchService and CalendarBatchWrapper - Explain how getCalendar() integrates with batching - Include architecture, data model, and performance considerations Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * fix: address cubic-dev-ai review comments - Remove misleading comment from getCalendar.ts cache block - Fix typo 'optmization' -> 'optimization' in comment - Add comprehensive tests for CalendarBatchWrapper batching behavior - Test separate calls for calendars without delegationCredentialId - Test batching calendars with same delegationCredentialId - Test chunking into groups of 50 for API limits - Test mixed calendars handling - Test fallbackToPrimary with empty array - Test result flattening from batched calls - Test pass-through methods delegation Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * fix: add shouldServeCache param to CalendarBatchWrapper and verify batching call count - Fix CalendarBatchWrapper.getAvailability signature to match Calendar interface (add shouldServeCache param) - Update CalendarBatchWrapper tests to pass shouldServeCache parameter - Add integration test in CalendarService.test.ts that verifies CalendarBatchWrapper makes separate API calls for different delegationCredentialIds (call count assertion) - This fixes the getCalendarsEvents test failures caused by signature mismatch Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * Improve CalendarBatchImplementation * test: add shouldServeCache forwarding and order-independent batching verification tests Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * test: make CalendarBatchWrapper tests order-independent Refactored tests to avoid relying on Promise.all execution order: - 'should make separate calls for calendars without delegationCredentialId' now uses set comparison instead of toHaveBeenNthCalledWith - 'should batch calendars with the same delegationCredentialId together' now finds calls by delegation credential instead of call order This addresses Sean's review comment about potential flakiness due to Promise.all not guaranteeing execution order of parallel promises. Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * Remove hardcoded ID * test: add comprehensive tests for resolveCalendarServeStrategy Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * feat: use Promise.allSettled for partial failure handling in CalendarBatchWrapper - Changed Promise.all to Promise.allSettled in getAvailability and getAvailabilityWithTimeZones - Returns partial results when some batches fail instead of failing entirely - Logs warnings for failed batches with error details - Added tests for partial failure scenarios Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * test: add comprehensive tests for getAvailabilityWithTimeZones - Added batching behavior tests (separate calls, batching by delegationCredentialId, chunking) - Added partial failure handling tests (partial results, all fail, no throw) - Added edge case test for underlying calendar not implementing the method - Total: 24 tests now covering both getAvailability and getAvailabilityWithTimeZones Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix: add required serviceAccountKey fields to delegatedTo mock objects Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix: add missing client_id and private_key to serviceAccountKey mock Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: keith@cal.com <keithwillcode@gmail.com> |
||
|
|
975fb21d86 |
feat(atoms): add ListEventTypes atom to enable event type management (#25047) (#25113)
* feat: add ListEventTypes atom (#25047) * feat: add ListEventTypes atom for Platform (#25047) - Add EventTypeListItem component in @calcom/features - Add ListEventTypesPlatformWrapper with delete functionality - Implement useAtomGetAllEventTypes hook - Update backend to include slug, description, length - Add 11 unit tests (65% coverage) - Add 3 i18n keys No breaking changes. Backward compatible. * refactor(eventtypes): improve EventTypeListItem readability - Extract EventTypeContent and EventTypeActions sub-components - Add formatEventTypeDuration helper (90min → '1h 30m') - Use Badge for duration display (consistency with EventTypeDescription) - Use polymorphic Wrapper component (DRY) - Add comprehensive tests - Reduce main component size Addresses @volnei feedback * refactor: replace window.confirm with ConfirmationDialog - Replace native window.confirm with ConfirmationDialogContent - Update test mocks for Dialog components - Fix HTML nesting (div instead of p for Badge container) - Follows Cal.com pattern from AvailabilitySettings Addresses @ThyMinimalDev feedback * fix: add aria-label to options button for accessibility * test: update getBulkEventTypes test to include new fields (description, slug, length) * refactor: move EventTypeListItem to atoms package --------- Co-authored-by: Morgan <33722304+ThyMinimalDev@users.noreply.github.com> |
||
|
|
4e1d05a7e7 |
feat: dist tracing 4 (#25574)
* feat: distributed tracing 2 * feat: distributed tracing 2 * refactor: feedback * refactor: feedback * fix: type error * fix: trpc error * feat: distributed tracing - 3 * chore: translation * refactor: improvements * fix: feedback * chore: remove * feat: dist tracing 4 * fix: type errors * fix: type errors * fix: remove string type * fix: type errors |
||
|
|
717a26f223 |
fix: prevent bulk update of locked locations in child managed event types (#24978)
* fix: prevent bulk update of locked locations in child managed event types - Filter out child managed event types with locked locations in getBulkUserEventTypes - Add validation in bulkUpdateEventsToDefaultLocation to prevent updating locked fields - Implements defense in depth with validation at multiple layers Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com> * Abstract filtering logic * test: add comprehensive tests for bulk location update filtering - Add unit tests for filterEventTypesWhereLocationUpdateIsAllowed - Add unit tests for bulkUpdateEventsToDefaultLocation - Add integration tests for getBulkUserEventTypes - Fix bug: change unlockedFields?.locations check from !== undefined to === true This ensures that locations: false is properly treated as locked, addressing the security issue identified in PR review comments Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com> * fix: filter locked managed event types on app installation page - Add parentId to eventTypeSelect in getEventTypes function - Apply filterEventTypesWhereLocationUpdateIsAllowed to both team and user event types - Only filter when isConferencing is true to avoid affecting other app types - Fixes issue where locked managed event types were showing in the event type selection list on /apps/installation/event-types page Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com> * fix(embed-react): remove obsolete availabilityLoaded event listener The availabilityLoaded event does not exist in the EventDataMap type system in embed-core. This code was causing 5 TypeScript errors in CI: - Type 'availabilityLoaded' does not satisfy constraint 'keyof EventDataMap' - 'data' is of type 'unknown' (2 occurrences) - Type 'availabilityLoaded' is not assignable to action union (2 occurrences) Since this is an example file and the event is not defined in the type system, removing this obsolete code resolves the type errors. Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com> * fix: correct Prisma type for metadata in test helper function Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com> * fix: use flexible PrismaLike type for better test compatibility Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com> * fix: properly type mock Prisma objects in test files Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com> * fix: properly mock Prisma methods in test file Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com> * Filter out metadata * Undo change in embed file * Address feedback --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> |
||
|
|
cc1efe1298 |
fix: Conditional fetch cache (#24816)
* Fix cache to fetch only when it's available * Non hierarchical feature check * Fix tests: Add missing mock method and comprehensive CalendarCacheWrapper tests - Add checkIfUserHasFeatureNonHierarchical to features.repository mock to fix failing GoogleCalendar tests - Add comprehensive unit tests for CalendarCacheWrapper covering: - Calendars with sync only (cache-only path) - Calendars without sync only (original calendar path) - Mixed calendars (both cache and original) - Timezone handling with UTC defaults - Edge cases (empty arrays, undefined methods, null ids) - Use proper types instead of 'as any' to satisfy lint rules Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * Fix: Sanitize logging to avoid exposing PII - Replace logging full selectedCalendars objects with only calendar IDs and count - Prevents exposure of email fields and other sensitive information in logs - Addresses AI code reviewer feedback Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * Apply suggestion from @volnei --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> |
||
|
|
a73b804d48 |
refactor: Split EmailManager into focused service files (#24997)
* refactor: Split EmailManager into focused service files - Created separate service files for different email categories: - auth-email-service.ts: Authentication and verification emails - organization-email-service.ts: Organization and team emails - billing-email-service.ts: Payment and credit-related emails - integration-email-service.ts: Integration and app-related emails - workflow-email-service.ts: Workflow and custom emails - recording-email-service.ts: Recording and transcript emails - Refactored email-manager.ts to keep only core booking lifecycle functions - Removed unused imports from email-manager.ts - Updated index.ts to export from all new service files - Updated all imports across the codebase to use package root (@calcom/emails) - Fixed lint warnings in handleChildrenEventTypes.ts This reduces the import cost of EmailManager by allowing consumers to import only the specific email services they need. Co-Authored-By: morgan@cal.com <morgan@cal.com> * refactor: Update all imports to use direct service file paths - Update 49 files to import directly from service files instead of barrel file - Update packages/emails/index.ts to keep only email-manager and renderEmail exports - Fix dynamic import in passwordResetRequest.ts - Update renderEmail imports to use direct path - Update test file to import from specific service module - Fix ESLint warnings in modified files (unused variables, unused expressions) This ensures consumers only import the specific email services they need, reducing import cost by avoiding the barrel file pattern for service files. Co-Authored-By: morgan@cal.com <morgan@cal.com> * fix: Use default import for renderEmail renderEmail is exported as a default export, not a named export. Changed from 'import { renderEmail }' to 'import renderEmail'. Co-Authored-By: morgan@cal.com <morgan@cal.com> * fix: Update test mocks to use direct service file imports - Update handleNoShowFee.test.ts to mock @calcom/emails/billing-email-service - Update credit-service.test.ts to mock @calcom/emails/billing-email-service - These tests were failing because they were mocking the barrel file @calcom/emails which no longer exports service functions after the refactoring Co-Authored-By: morgan@cal.com <morgan@cal.com> * fix: unit test spy * fix: unit test mock * address cubic comments * fix: type error sendMonthlyDigestEmail * remove barrel file and sendEmail unused task * fixup! remove barrel file and sendEmail unused task * fixup! fixup! remove barrel file and sendEmail unused task * fix: integration test mock emails --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: hbjORbj <sldisek783@gmail.com> |
||
|
|
7d17b443cf |
chore: Add cache log (#24954)
* Add log * Update getCalendar.ts |
||
|
|
8e818e0567 |
refactor: remove-zapier-setup-screen (#24652)
* refactor: remove-zapier-setup-screen * remove setup page files, related config and update readme * make zapier a redirecting app * update readme * add check for missing website * add noopener,noreferrer for _blank links |
||
|
|
91063c41f8 |
chore: Determine to serve cache high level (#24756)
* chore: Determine to serve cache high level * Fix invalid import * fix: Cache test |
||
|
|
6923b97cd2 |
feat: upgrade Prisma to 6.16.0 with no-rust engine (#23816)
* feat: upgrade Prisma to 6.16.0 with no-rust engine - Update Prisma packages to 6.16.0 - Add PostgreSQL adapter dependency - Configure engineType: 'client' and provider: 'prisma-client' in schema - Update Prisma client instantiation with PostgreSQL adapter - Remove binaryTargets from generators (not needed with library engine) - Fix schema view issue by removing @id decorator from BookingTimeStatusDenormalized - Fix ESLint warning by removing non-null assertion Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * Web app running but types wrecked * web app running but build and type issues * Removed the connection pool * Fixed zod type issue * Fixed types in booking reference extension * Fixed test issues * Type checks passing it seems * Using cjs as moduleFormat * Fixing Prisma undefined * fix: update prismock initialization for Prisma 6.16 compatibility - Add @prisma/internals dependency for getDMMF() - Restructure prismock initialization to use createPrismock() with DMMF - Create Proxy that's returned from mock factory for proper spy support - Fixes 89 failing unit tests with 'Cannot read properties of undefined (reading datamodel)' error - Based on workaround from prismock issue #1482 All unit tests now pass (375 test files, 3323 tests passed) Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix: cast serviceAccountKey to Prisma.InputJsonValue in bookingScenario.ts - Apply type cast at lines 2493 and 2535 - Fixes type errors from Prisma 6.16 upgrade - Follows established pattern from delegationCredential.ts - Add eslint-disable for pre-existing any types - Rename unused appStoreLookupKey parameter to satisfy lint - All 3323 tests passing Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * chore: remove whitespace-only lines from bookingScenario.ts - Remove blank lines where eslint-disable comments were replaced - Cleanup from pre-commit hook formatting Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * Update is-prisma-available-check.ts * fix: remove datasources config when using Prisma Driver Adapters - Update customPrisma to create new adapter when datasources URL is provided - Remove datasources config from API v2 Prisma services (already in adapter) - Fixes 'Custom datasource configuration is not compatible with Prisma Driver Adapters' error Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix: use Pool instances for PrismaPg adapters in index.ts - Create Pool instance before passing to PrismaPg adapter - Update customPrisma to create Pool for custom connection strings - Matches working pattern from API v2 services - Fixes 'Invalid `prisma.$queryRawUnsafe()` invocation' error Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * Not using queryRawUnsafe * Trying anything at this point * Make sure the DB is ready first * Don't auto run migrations in CI mode * Revert "Make sure the DB is ready first" This reverts commit 2b20bd45c974f3d7e07d8b904bc7fcdae37cce03. * Dynamic import of prisma * Commenting where it seems to break * Backwards compatability for API v2 * fix: add explicit type annotations for map callbacks in API v2 - Add type annotation for map parameter in memberships.repository.ts - Add type annotation for map parameter in stripe.service.ts - Fixes implicit 'any' type errors from stricter Prisma 6.16.0 type inference Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix: add explicit type annotations for API v2 map callbacks - users.repository.ts:292: add Profile & { user: User } type - memberships.service.ts:19-20: add Membership type to filter callbacks Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix: add explicit type annotation for attributeToUser in organizations-users.repository.ts - organizations-users.repository.ts:63: add AttributeToUser with nested relations type Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix: add explicit Membership type annotations in teams.repository.ts Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix: use API v2 dedicated Prisma client to support adapter in PrismaClientOptions Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * Running API v2 build commands together so they all get the space size var * Fixing Maximum call depth exceeded error * fixed type issues * Trying to make the seed more stable * Revert "Trying to make the seed more stable" This reverts commit 1fd4495e6af7acd7981cda7dedec3168979b0e9d. * Fixed path to prisma client * Fixed type check * Fix eslint warnings * fix: externalize @prisma/adapter-pg and pg in platform-libraries Vite config - Add @prisma/adapter-pg and pg to external dependencies list - Add corresponding globals for these packages - Fix Prisma client aliases to point to packages/prisma/client instead of node_modules - Add Node.js resolve conditions to prefer Node.js exports - Keep commonjsOptions.include for proper CommonJS transformation - Add eslint-disable for __dirname in Vite config file - Remove problematic prettier/prettier eslint comment This fixes the 'Extensions.defineExtension is unable to run in this browser environment' error when running yarn generate-swagger in apps/api/v2 after upgrading to Prisma v6.16 with the no-rust engine approach. Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix: update Prisma imports in API v2 services to use package path - Change imports from '../../../generated/prisma/client' to '@calcom/prisma/client' - Fixes CI error: Cannot find module '../../../../../packages/prisma/generated/prisma/client.ts' - Aligns with backwards compatibility re-export structure after Prisma v6.16 upgrade Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix: remove .ts extension from Prisma client path mapping in tsconfig - Remove file extension from @calcom/prisma/client path mapping - Fixes runtime error: Cannot find module '../../../../../packages/prisma/generated/prisma/client.ts' - TypeScript path mappings should not include file extensions per best practices - Allows Node.js to correctly resolve to .js files at runtime Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix: resolve Prisma 6.16.0 type incompatibilities in bookingScenario tests - Changed InputPayment.data type from PaymentData to Prisma.InputJsonValue - Changed createCredentials key parameter from JsonValue to InputJsonValue - Removed unused PaymentData type definition - Resolves type errors at lines 709 and 1088 without using 'as any' casts Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix: remove non-existent Watchlist fields from test fixtures - Remove createdById from isLockedOrBlocked.test.ts (lines 15, 20) - Remove severity and createdById from _post.test.ts (line 110) - These fields don't exist in Watchlist model schema after Prisma 6.16.0 upgrade - Resolves TS2353 errors without using 'as any' casts Relates to PR #23816 Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix: api v2 imports generated prisma and platform libraries * fix: resolve type errors from Prisma 6.16 upgrade - Add missing markdownToSafeHTML import in AppCard.tsx - Fix organizationId null handling in fresh-booking.test.ts - Remove non-existent createdById field from Watchlist test utils Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * Put back some external rollups * Added back the resolve conditions * Stop using Pool directly * chore: remove prisma bookingReferenceExtension and update calls * fix: organizations-admin-not-team-member-event-types.e2e-spec.ts * chore: bring back POOL in api v2 prisma clients * chore: remove Pool but await connect * fixup! chore: remove Pool but await connect * chore: bring back Pool on all clients * chore: end pool manually * chore: test with pool max 1 * chore: e2e test prisma max pool of 1 connection * chore: give more control over pool for prisma module with env * remove pool from base prisma client * chore: prisma client in libraries use pool * Fixed types * chore: log pool events and improve pooling * Fixing some types and tests * Changing the parsing of USE_POOL * fix: ensure Prisma client is connected before seeding to prevent transaction errors Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * chore: adjust pools * chore: add process.env.USE_POOL to libraries vite config * fix: v1 _patch reference check bookingRef on the booking find * fix: v1 get references deleted null for system admin * test: add integration tests for bookingReference soft-delete behavior - Add bookingReference.integration-test.ts to test repository methods - Add handleDeleteCredential.integration-test.ts to test credential deletion cascade - Add booking-references.integration-test.ts for API v1 integration tests - All tests verify soft-delete behavior without using mocks - Tests use real database operations to ensure soft-deleted records persist - Cover scenarios: replacing references, credential deletion, querying with filters Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * refactor: convert booking-references test to actual API endpoint testing - Modified _get.ts to export handler function for testing - Refactored integration test to call API handler instead of directly testing Prisma - Added timestamps to test data to avoid conflicts - Tests now verify API layer correctly filters soft-deleted references - All 4 tests passing Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix: add explicit prisma.$connect() call to seed-insights script With Prisma 6.16 and the PostgreSQL adapter, scripts need to explicitly call $connect() before running database operations to ensure the connection pool is properly initialized. This prevents 'Transaction already closed' errors. Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix: add $connect() to main() execution in seed-insights Both main() and createPerformanceData() entry points need explicit prisma.$connect() calls with the Prisma 6.16 PostgreSQL adapter. Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix: always use connection pool for Prisma PostgreSQL adapter Enable connection pooling by default for the Prisma adapter to prevent transaction state issues during seed operations. Without a pool, each operation creates a new connection which can lead to 'Transaction already closed' errors during heavy database operations like seeding. Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * Revert "fix: always use connection pool for Prisma PostgreSQL adapter" This reverts commit 6724bb08e42bc0a94846069de83b04db0aeb8e8b. * fix: enable connection pool for db-seed in cache-db action Set USE_POOL=true when running yarn db-seed to use connection pooling with the Prisma PostgreSQL adapter. This prevents 'Transaction already closed' errors during seeding by maintaining stable database connections. Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix: add safety check for undefined ownerForEvent in seed script Prevent 'Cannot read properties of undefined' error when orgMembersInDBWithProfileId is empty. This can happen if organization members fail to create or when there's a duplicate constraint violation causing early return. Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix: v1 _patch reference check bookingRef * fix: increase pool size and add timeout settings to prevent transaction errors - Increase max connections from 5 to 10 - Add connectionTimeoutMillis: 30000 (30 seconds) - Add statement_timeout: 60000 (60 seconds) These settings help prevent 'Unknown transaction status' errors during heavy database operations like seeding by giving transactions more time to complete and allowing more concurrent connections. Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * Revert "fix: increase pool size and add timeout settings to prevent transaction errors" This reverts commit 148264f1f1861dfb09a082937a3e2b49e78fc41a. * fix: remove standalone execution in seed-app-store to prevent premature disconnect The seed-app-store.ts file had a standalone main() call at the bottom that would execute immediately when imported, including a prisma.$disconnect() in its .finally() block. This caused issues because: 1. seed.ts imports and calls mainAppStore() 2. The import triggers the standalone main() execution 3. This standalone execution disconnects prisma after completion 4. seed.ts then tries to call mainHugeEventTypesSeed() but prisma is disconnected 5. This leads to 'Unknown transaction status' errors Fixed by removing the standalone execution since mainAppStore() is already called programmatically from seed.ts which manages the connection lifecycle. Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix: use require.main check to prevent premature disconnect when imported Added require.main === module check so seed-app-store.ts: - Runs standalone with proper connection management when executed directly via 'yarn seed-app-store' or 'ts-node seed-app-store.ts' - Does NOT run standalone when imported as a module by seed.ts, preventing premature prisma disconnect This fixes 'Unknown transaction status' errors while maintaining backward compatibility for direct execution. Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix: seed apps before creating users to prevent foreign key constraint violation Reordered seeding operations to call mainAppStore() before main() because: - main() creates users with credentials that reference apps via appId foreign key - mainAppStore() seeds the App table with app records - Apps must exist before credentials can reference them This fixes the 'Foreign key constraint violated on Credential_appId_fkey' error that occurred when creating credentials before the apps they reference existed. Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * Apply suggestion from @cubic-dev-ai[bot] Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com> * Removing functional changes of deleted: null * Apply suggestion from @keithwillcode * refactor: move seedAppData call to bottom of main() in seed.ts Moved seedAppData() call from seed-app-store.ts to the bottom of main() in seed.ts to ensure the 'pro' user is created before attempting to create routing form data for them. Changes: - Exported seedAppData function from seed-app-store.ts - Removed seedAppData() call from the main() export in seed-app-store.ts - Added seedAppData() call at the bottom of main() in seed.ts - Updated standalone execution in seed-app-store.ts to still call seedAppData() when run directly via 'yarn seed-app-store' This ensures proper ordering: apps seeded → users created → routing form data created for existing users. Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * refactor: move routing form seeding from seed-app-store.ts to seed.ts Moved the routing form seeding logic (previously in seedAppData function) from seed-app-store.ts to be inline at the bottom of main() in seed.ts. This ensures the 'pro' user is created before attempting to create routing form data for them. Changes: - Removed seedAppData function and seededForm export from seed-app-store.ts - Removed import of seedAppData from seed.ts - Added routing form seeding logic inline at bottom of main() in seed.ts Seeding order: apps → users (including 'pro') → routing forms Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix: add deleted: null filter to bookingReference update operations - Add deleted: null filter to API v1 PATCH endpoint to prevent updating soft-deleted booking references - Add deleted: null filter to DailyVideo updateMeetingTokenIfExpired and setEnableRecordingUIAndUserIdForOrganizer - Add comprehensive test coverage for PATCH endpoint soft-delete behavior - Tests verify that soft-deleted booking references cannot be updated - Tests verify that only active booking references can be updated successfully Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * revert: remove deleted: null filters to preserve existing functionality Per @keithwillcode's feedback, reverting the soft-delete filtering changes to preserve existing functionality in this PR. This PR should focus only on the Prisma upgrade itself. - Reverted API v1 PATCH endpoint change - Reverted DailyVideo adapter changes (updateMeetingTokenIfExpired and setEnableRecordingUIAndUserIdForOrganizer) - Removed test file that was added for soft-delete behavior testing Addresses comments: - https://github.com/calcom/cal.com/pull/23816#discussion_r2448854197 - https://github.com/calcom/cal.com/pull/23816#discussion_r2448860594 - https://github.com/calcom/cal.com/pull/23816#discussion_r2448860833 Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * test: restore and update booking reference tests to match existing functionality Updated tests to verify existing behavior where PATCH endpoint can update booking references regardless of their deleted status. This matches the current implementation after reverting the deleted: null filters. Changes: - Restored test file that was previously deleted - Updated PATCH tests to expect successful updates of soft-deleted references - Renamed test suite to 'Existing functionality' to clarify intent - Tests now verify that the PATCH endpoint preserves existing behavior Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * test: rename booking-references test to integration-test The test requires a database connection and should run in the integration test job, not the unit test job. Renamed from .test.ts to .integration-test.ts to match the repository's testing conventions. Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: cal.com <morgan@cal.com> Co-authored-by: Morgan <33722304+ThyMinimalDev@users.noreply.github.com> Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com> |
||
|
|
e91bf53d80 |
refactor: Remove circular deps between @calcom/lib and @calcom/features [2] (#24438)
* move SystemField to features * migrate workflow service * merge two tests for team repository * update imports and migrate team repository * migrate delegation credential repository * migrate credential repository * migrate entityPermissionUtils * migrate hashedLink service and repository * migrate membership service * update imports * remove file * migrate buildEventUrlFromBooking * migrate getAllUserBookings to features * update imports * update organizationMock * migrate slots * migrate date-ranges to schedules dir * migrate getAggregatedAvailability * fix * refactor * migrate useCreateEventType hook to features * migrate assignValueToUser * migrate validateUsername to auth features * migrate system field back to lib * migrate getLabelValueMapFromResponses back to lib * update imports * use relative path * fix type checks * fix * fix * fix tests * update gh codeowners * fix * fix |
||
|
|
ff38d6c7db |
refactor: Remove circular deps between @calcom/lib and @calcom/features [1] (#24399)
* add eslint config * migrate autoLock to features * migrate teamService to features * migrate userCreationService * migrate insights services to features * migrate ProfileRepository * update imports * migrate filter segmen tests * migrate filter segment repository * migrate getBusyTimes * migrate getLocaleFromRequest * refactor csvUtils * make filename clearer * migrate getLuckyUser integration test * migrate autoLock test to features * wip * refactors * migrate useBookerUrl * migrate more * wip * Migrate eventTypeRepository * membership repository * update imports * update imports * migrate * move organization repository * update imports * update imports * wip * wip * wip * wip * wip * wip * wip * wip * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix tests * fix type checks * fix * fix * migrate * update imports * fix tests * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix |
||
|
|
bb68cd73ef |
refactor: circular deps between app store and lib [6] (#23971)
* move delegation credential repository to features * mv credential repository to features * update imports * mv * fix * fix * fix * fix * fix * update imports * update imports * update eslint rule * fix * fix * mv getConnectedDestinationCalendars * fix import errors * mv getCalendarsEvents * remove getUsersCredentials * wip * revert eslint rule change for now * fix type checks * fix * format * cleanup * fix * fix * fix * fix * fix tests * migrate getUserAvailability * migrate * fix tests * fix type checks * fix * fix * migrate crmManager * update imports * migrate raqbUtils to appstore * migrate getLuckyUser to features * migrate findTeamMembersMatchingAttributeLogic to appstore * update imports * fix * fix * fix test * fix unit tests * fix * fix * add eslint config |
||
|
|
e6b2116a2b |
feat: Calendar Cache and Sync (#23876)
* feat: calendar cache and sync - wip * Add env.example * refactor on CalendarCacheEventService * remove test console.log * Fix type checks errors * chore: remove pt comment * add route.ts * chore: fix tests * Improve cache impl * chore: update recurring event id * chore: small improvements * calendar cache improvements * Fix remove dynamic imports * Add cleanup stale cache * Fix tests * add event update * type fixes * feat: add comprehensive tests for new calendar subscription API routes - Add tests for /api/cron/calendar-subscriptions-cleanup route (9 tests) - Add tests for /api/cron/calendar-subscriptions route (10 tests) - Add tests for /api/webhooks/calendar-subscription/[provider] route (11 tests) - Add missing feature flags for calendar-subscription-cache and calendar-subscription-sync - All 30 tests pass with comprehensive coverage of authentication, feature flags, error handling, and service instantiation Tests cover: - Authentication scenarios (API key validation, Bearer tokens, query parameters) - Feature flag combinations (cache/sync enabled/disabled states) - Success and error handling (including non-Error exceptions) - Service instantiation with proper dependency injection - Provider validation for webhook endpoints Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * feat: add comprehensive tests for calendar subscription services, repositories, and adapters - Add unit tests for CalendarSubscriptionService with subscription, webhook, and event processing - Add unit tests for CalendarCacheEventService with cache operations and cleanup - Add unit tests for CalendarSyncService with Cal.com event filtering and booking operations - Add unit tests for CalendarCacheEventRepository with CRUD operations - Add unit tests for SelectedCalendarRepository with calendar selection management - Add unit tests for GoogleCalendarSubscriptionAdapter with subscription and event fetching - Add unit tests for Office365CalendarSubscriptionAdapter with placeholder implementation - Add unit tests for AdaptersFactory with provider management and adapter creation - Fix lint issues by removing explicit 'any' type casting and unused variables - All tests follow Cal.com conventions using Vitest framework with proper mocking Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * fix: improve calendar-subscriptions-cleanup test performance by adding missing mocks - Add comprehensive mocks for defaultResponderForAppDir, logger, performance monitoring, and Sentry - Fix slow test execution (933ms -> <100ms) caused by missing dependency mocks - Ensure consistent test performance across different environments Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * Fix tests * Fix tests * type fix * Fix coderabbit comments * Fix types * Fix test * Update apps/web/app/api/cron/calendar-subscriptions/route.ts Co-authored-by: Alex van Andel <me@alexvanandel.com> * Fixes by first review * feat: add database migrations for calendar cache and sync fields - Add CalendarCacheEventStatus enum with confirmed, tentative, cancelled values - Add new fields to SelectedCalendar: channelId, channelKind, channelResourceId, channelResourceUri, channelExpiration, syncSubscribedAt, syncToken, syncedAt, syncErrorAt, syncErrorCount - Create CalendarCacheEvent table with foreign key to SelectedCalendar - Add necessary indexes and constraints for performance and data integrity Fixes database schema issues causing e2e test failures with 'column does not exist' errors. Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * only google-calendar for now * docs: add Calendar Cache and Sync feature documentation - Add comprehensive feature overview and motivation - Document feature flags with SQL examples - Include SQL examples for enabling features for users and teams - Reference technical documentation files Addresses PR #23876 documentation requirements Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * docs: update calendar subscription README with comprehensive documentation - Undo incorrect changes to main README.md - Update packages/features/calendar-subscription/README.md with: - Feature overview and motivation - Environment variables section - Complete feature flags documentation with SQL examples - SQL examples for enabling features for users and teams - Detailed architecture documentation Addresses PR #23876 documentation requirements Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com> * fix docs * Fix test to available calendars * Fix test to available calendars * add migration and sync boilerplate * fix typo * remove double log * sync boilerplate --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Alex van Andel <me@alexvanandel.com> Co-authored-by: Keith Williams <keithwillcode@gmail.com> |
||
|
|
76332a759b |
refactor: circular deps between app store and lib [5] (#23936)
* getBulkEventTypes * 2 eventtypes related utils to features * locationsResolver * checkForEmptyAssignment * mv defaultEvents to features * update imports * PrismaAppRepository * mv currencyConversions from appstore to lib * useAppsData * videoClient * analytics files * fix * mv * prettier * use named import |
||
|
|
b3a28dca25 |
refactor: circular deps between app store and lib [4] (#23829)
* mv team queries to features from lib * update imports * same * wip * move event manager test * calendar manager to features from lib * update imports * update imports * fix * mv getEventTypeById * fix * fix * remove * fix type check error * fix tests * fix tests * fix |
||
|
+1 |
55e6682832 |
feat: Custom Fields OR Add-Ons with a fee associated (#19997)
* feat: Addons to bookings * Add tests * Add tests * Fix price field not shown immediately after enabling payment for an event * Add support for all currencies in addons and fix type errors * Address review comments * Add tests to cover all input types * Address cubic-dev-ai comments * Remove openapi.json from git tracking * Revert changes * Revert unrelated linter/formatter changes * Address cubic-dev-ai comments * Addres cubic-dev-ai comment * Update to use test id instead of hardcoded label Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Address coderabbits review comments * Fix failing unit test * some fixes... * Fix tests * Fix import * Move handlePayment test file to appropriate location * Fix test --------- Co-authored-by: Omar López <zomars@me.com> Co-authored-by: amrit <iamamrit27@gmail.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Kartik Saini <41051387+kart1ka@users.noreply.github.com> Co-authored-by: Anik Dhabal Babu <81948346+anikdhabal@users.noreply.github.com> Co-authored-by: Devanshu Sharma <devanshusharma658@gmail.com> Co-authored-by: Benny Joo <sldisek783@gmail.com> Co-authored-by: Peer Richelsen <peeroke@gmail.com> Co-authored-by: Volnei Munhoz <volnei.munhoz@gmail.com> |
||
|
|
3aab13b4da |
refactor: circular deps between app store and lib [3] (#23742)
* getEnabledAppsFromCredentials * wip * wip * mv more * fix: update test mocking for PrismockClient in processPaymentRefund.test.ts - Replace prismaMock with prismock for proper PrismockClient usage - Update mock data structure to include required fields (id, userId, teamId, etc.) - Create app and credential records separately to handle PrismockClient limitations - Replace 'as any' type casting with vi.mocked() for proper type safety - Adjust test expectations to match PrismockClient's actual return structure - Add proper cleanup in beforeEach hook for both credential and app records Fixes failing unit tests after migration from packages/lib to packages/features/bookings/lib/payment Co-Authored-By: benny@cal.com <sldisek783@gmail.com> * publish platform libraries * fix import * bump version * fix apiv2 * publish platform-libraries --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> |
||
|
|
79a09362c9 |
refactor: remove circular dependency between prisma and app-store packages (#23475)
* refactor: remove circular dependency between prisma and app-store packages - Replace EventTypeAppMetadataSchema with z.record(z.any()).optional() pattern - Remove appDataSchemas import from packages/prisma/zod-utils.ts - Add null checks in consuming packages for flexible validation - Fix test file that no longer needs @ts-expect-error directive This breaks the circular dependency while maintaining all functionality by moving strict validation to the business logic layer where operations actually happen, following existing patterns in the codebase. Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * refactor: remove EventTypeAppMetadataSchema exports from prisma package - Remove EventTypeAppMetadataSchema and eventTypeAppMetadataOptionalSchema exports from prisma/zod-utils.ts - Update all importing files to use local z.record(z.any()).optional() schemas - Replace type annotations with Record<string, any> where appropriate - Maintain validation functionality while breaking circular dependency - All TypeScript compilation now passes without errors Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * refactor: complete removal of EventTypeAppMetadataSchema from remaining files - Update handleSeats/createNewSeat.ts to use local schema - Update payment handlers to use local schemas - Update eventTypes update handler to use local schema - All files now define their own validation instead of importing from prisma - Circular dependency completely eliminated Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix: resolve TypeScript compilation errors - Remove duplicate z import from handleConfirmation.ts - Remove duplicate appDataSchemas import from update.handler.ts - Fix index signature errors in handlePayment.ts by using appData variable consistently - All type checks now pass successfully Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix: add type casting for appSlug in eventTypeService - Cast appSlug as keyof typeof apps to resolve index signature error - Maintains type safety while allowing dynamic property access Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix * remove * make zod-utils.ts in app-store * update imports * fix * fix * fix * revert unrelated change * update imports * fix * fix * revert * fix * fix --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: hbjORbj <sldisek783@gmail.com> |
||
|
|
c28eb90928 |
chore: Upgrade prisma to 6.7.0 (#21264)
* chore: Upgrade prisma to 6.7.0 * Build fixes * type fixes Signed-off-by: Omar López <zomars@me.com> * Update schema.prisma * Patching * Revert "Update schema.prisma" This reverts commit 47d8618bf89ef4d007b30084df766f17281e21a1. * Revert "Patching" This reverts commit a1d2e3040e71690a44d4324db95d73b4d68c6adb. * Revert schema changes Signed-off-by: Omar López <zomars@me.com> * WIP Signed-off-by: Omar López <zomars@me.com> * Update getPublicEvent.ts * Update imports Signed-off-by: Omar López <zomars@me.com> * Update gitignore Signed-off-by: Omar López <zomars@me.com> * update remaining imports Signed-off-by: Omar López <zomars@me.com> * Delete .cursor/config.json * Discard changes to packages/features/eventtypes/lib/getPublicEvent.ts * Update _get.ts * Update user.ts * Update .gitignore * update * Update WorkflowStepContainer.tsx * Update next-auth-custom-adapter.ts * Update getPublicEvent.ts * Update workflow.ts * Update next-auth-custom-adapter.ts * Update next-auth-options.ts * Update bookingScenario.ts * fix missing imports * upgrades prismock Signed-off-by: Omar López <zomars@me.com> * patches prismock Signed-off-by: Omar López <zomars@me.com> * Update reschedule.test.ts * Update prisma.ts * patch prismock Signed-off-by: Omar López <zomars@me.com> * fix enums imports Signed-off-by: Omar López <zomars@me.com> * Revert "Update prisma.ts" This reverts commit 64edcf8db54171ff4456c209d563b5d431d99619. * Revert "patch prismock" This reverts commit e95819113dc9d88e7130947aa120cd42710977c8. * fix patch * Fix test that overrun the boundary, it shouldn't test too much * Move prisma import to changeSMSLockState * Bring back broken test without illegal imports * Merge with main and fix filter hosts by same round robin host * Fixed buildDryRunBooking fn tests * Fix and move ooo create or update handler test * Fix packages/features/eventtypes/lib/isCurrentlyAvailable.test.ts * Fix packages/trpc/server/routers/viewer/organizations/listMembers.handler.test.ts * Mock @calcom/prisma * Fix: verify-email.test.ts * fix: Moved WebhookService test and fixed default import mock * Fix: Added missing prisma mock, handleNewBooking uses that of course * We're not testing createContext here * fix: Prisma mock fix for listMembers.test.ts * More fixes to broken testcases * Forgot to remove borked test * Prevent the need to mock a lot of dependencies by moving out buildBaseWhereCondition to its own file * Temporarily skip getCalendarEvents, needs a rewrite * Fix: turns out you can access protected in testcases * fix further mocks * Added packages/features/insights/server/buildBaseWhereCondition.ts, types * Always great to have a mock and then not use it * And one less again. * fix: confirm.handler.test, didn't mock prisma * fix: Address minor nit by @eunjae & fix ImpersonationProvider test * Updated isPrismaAvailableCheck that doesn't crash on import * fix: Get Prisma directly from the client, it usually involves the Validator and does not need 'local' inclusion * Add zod-prisma-types without the generator enabled (commented out) * Uncomment and see what happens * Change method of import as imports did not work in Input Schemas * Remove custom 'zod' booking model, it does not belong with Prisma * Fix all other global Model imports * Rewrite most schema includes AND remove barrel file * Add bookingCreateBodySchema to features/bookings * Flurry of type fixes for compatibility with new zod gen * Refactor out the custom prisma type createEventTypeInput * Work around nullable eventTypeLocations * HandlePayment type fix * More fixes, final fix remaining is CompleteEventType * Should fix a bunch more booking related type errors * Missed one * Some props missing from BookingCreateBodySchema * Fix location type in handleChildrenEventTypes * Little bit hacky imo but it works * Final type error \o/ * Forgot to include Prisma * Do not include zod-utils in booker/types * Oops, was already including Booker/types * Fix membership type, also disallow updating createdAt/updatedAt, make part of patch/post * Fix api v1 type errors * Fix EventTypeDescription typings * Remove getParserWithGeneric, use userBodySchema with UserSchema * use centralized timeZoneSchema * Implement feedback by @zomars * Couple of WIP pushes * Fix tests * Type fixes in `handleChildrenEventTypes` test * Try and parse metadata before use * Change zod-prisma-types configuration for optimal performance * Fix prisma validator error in `prisma/selects/credential` * Disable seperate relations model, hits a bug * Import absolute - this makes rollup work in @platform/libraries * Attempt at removing resolutions override * Refactor using `Prisma.validator` to `satisfies` * Build atoms using @calcom/prisma/client * Build atoms using @calcom/prisma/client * fixes * Update eventTypeSelect.ts * Adjust `eventTypeMetaDataSchemaWithUntypedApps` from `unknown` to `record(any)` * `EventTypeDescription` rely on `descriptionAsSafeHTML` instead of `description` * Add `seatsPerTimeSlot` to event type public select * Fix typing in `users-public-view` getServerSide props * Add missing `schedulingType` to prop * chore: bump platform libraries * Function return type is illegal, not sure how this passed eslint (#21567) * Merged with main * Update updateTokenObject.ts * Update handleResponse.ts * Update index.ts * Update handleChildrenEventTypes.ts * Update booking-idempotency-key.ts * Update WebhookService.test.ts * Update events.test.ts * Update queued-response.test.ts * Update events.test.ts * Update getRoutedUrl.test.ts * fix: type checks Signed-off-by: Omar López <zomars@me.com> * fixes Signed-off-by: Omar López <zomars@me.com> * chore: bump platform libraries * Update yarn.lock * more fixes Signed-off-by: Omar López <zomars@me.com> * fixes Signed-off-by: Omar López <zomars@me.com> * biuld fixes * chore: bump platform libraries * Update conferencing.repository.ts * Update conferencing.repository.ts * Update getCalendarsEvents.test.ts * Update vite.config.js * chore: bump platform libraries * Update users.ts * Discard changes to docs/api-reference/v2/openapi.json * Update vite.config.ts * updated platform libraries * Update get.handler.test.ts * Update get.handler.test.ts * Update schema.prisma * Discard changes to docs/api-reference/v2/openapi.json * Update next-auth-custom-adapter.ts * Update team.ts * Flurry of type fixes * Fix majority of insight related type errors * Type fixes for unlink of account * Make user nullable again * Fixed a bunch of unit tests and one type error * Attempted mock fix * Attempted fix for Attribute type * Ensure default import becomes prisma, but not direct usage * Import default as prisma in prisma.module * Add attributeOption to attribute type * Fix calcom/prisma mock * Refactor Prisma client imports to @calcom/prisma/client Updated all imports from '@prisma/client' to '@calcom/prisma/client' across tests and repository files for consistency and to use the correct Prisma client package. This change improves maintainability and ensures the correct client is referenced throughout the codebase. * Undo removal of max-warnings=0 to get main to merge * Remove unit tests for e2e fixtures, provide new prisma mock * Mock @calcom/prisma in event manager * Mock @calcom/prisma in event manager * Add correct format even with --no-verify * Mock prisma in CalendarManager * Add mock for permission-check.service * Better injection in PrismaApiKeyRepository imports * More mock fixes :) * Fix listMembers.handler.test * Fix User import * Appropriately adjust all types to be imported as types, there were a lot of types imported as normal deps * Why was this a thing? * Strictly speaking; Not using prismock anymore * Ditched patch file for prismock * Fix output.service.ts platform type imports, need concrete for plainToClass * Better typing and tests for unlinkConnectedAccount.handler * Small type fix * Disable calendar cache tests as they are dependent on prismock * chore: bump platform lib * getRoutedUrl test remove of unused import * Extract select to external const on getEventTypesFromDB * Direct select of userSelect from selects/user * fix type error from merging 23653 * Fixed integration tests by removing hardcoded values that were possible due to mocking, but as its now directly hitting the db no longer * fix: vite config atoms prisma client type location * revert: example app prisma client * revert: example app prisma client * bump platform libs * fix: use class instead of type for DI of PlatformBookingsService * update platform libs * remove unused variable * chore: generate prisma client for api v2 * fix: api v2 e2e * fix: atoms e2e * fix: atoms e2e * fix: atoms e2e * fix: api v2 e2e * fix: tsconfig apiv2 enums * publish libraries * Simplify check for existence teamId --------- Signed-off-by: Omar López <zomars@me.com> Co-authored-by: Alex van Andel <me@alexvanandel.com> Co-authored-by: Joe Au-Yeung <j.auyeung419@gmail.com> Co-authored-by: supalarry <laurisskraucis@gmail.com> Co-authored-by: cal.com <morgan@cal.com> Co-authored-by: Morgan <33722304+ThyMinimalDev@users.noreply.github.com> Co-authored-by: Benny Joo <sldisek783@gmail.com> |
||
|
|
9156848503 |
refactor: circular deps between app store and lib [2] (#23734)
* mv getDefaultLocations * fix * 2 more utils * update imports * fix * move getConnectedApps * move handlePaymentSuccess * update imports * fix import * publish platform libraries |
||
|
|
aa51218428 |
perf: move to disable prisma client extension inference (#23692)
* perf: move to disable prisma client extension inference * Prisma doesn't like it when you pass Record<string, unknown> * API v1 type fixes * Missed one * Fix unit test fail due to faulty expect * Assigning to prisma InputJsonValue/Array must be done as object, not interface * Fix @calcom/web ts error, teams not defined * Run eslint formatter * fixed the routingFormHelpers file causing a failing app store e2e test |
||
|
|
95f8046db9 |
refactor: Error code - remove circular dep between app store <-> lib (#23669)
* remove stripe.types.ts * use stripe-error defined in packages/lib * refactor |