Files
calendar/packages/lib
Keith WilliamsGitHubDevin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
191db5104a perf: optimize video adapter imports to avoid loading entire app store (#23435)
* perf: optimize video adapter imports to avoid loading entire app store

- Creates VideoApiAdapterMap with lazy imports for 12 video services
- Updates getVideoAdapters function to use VideoApiAdapterMap instead of dynamic app store imports
- Preserves zoom app name parsing logic (zoom_video → zoomvideo)
- Follows same optimization pattern as calendar, analytics, and payment services
- Reduces bundle size by avoiding import of 100+ apps when only video functionality needed

Affected files:
- packages/app-store-cli/src/build.ts: Added video service generation logic
- packages/lib/videoClient.ts: Updated to use VideoApiAdapterMap
- packages/features/bookings/lib/handleCancelBooking.ts: Updated FAKE_DAILY_CREDENTIAL import
- packages/lib/EventManager.ts: Updated FAKE_DAILY_CREDENTIAL import
- packages/trpc/server/routers/viewer/calVideo/getMeetingInformation.handler.ts: Updated to use VideoApiAdapterMap
- apps/web/lib/video/[uid]/getServerSideProps.ts: Updated daily video function imports
- packages/app-store/video.services.generated.ts: Generated video adapter map with re-exports

Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>

* fix: add missing re-exports to video.services.generated.ts

- Updates build.ts to include FAKE_DAILY_CREDENTIAL and other daily video function re-exports
- Fixes type errors in EventManager.ts and other files importing from video.services.generated
- Ensures video adapter refactoring maintains all existing functionality

Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>

* fix: update video adapter test mocks to work with VideoApiAdapterMap

- Creates global mockVideoAdapterRegistry for dynamic video adapter mocks
- Uses Proxy in vi.mock for VideoApiAdapterMap to return registered mocks
- Updates mockVideoApp and mockErrorOnVideoMeetingCreation to register mocks
- Fixes unit test failures in booking scenario tests
- Ensures video meeting operations (createMeeting, updateMeeting, deleteMeeting) work correctly

Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>

* fix: remove re-exports from video.services.generated.ts and revert imports

- Remove re-export block from video.services.generated.ts as requested
- Revert imports back to pull directly from dailyvideo/lib/VideoApiAdapter
- Update build.ts to not generate the re-exports
- Maintains all existing functionality while addressing GitHub feedback

Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>

* fix: rename video.services.generated.ts to video.adapters.generated.ts

- Updates build.ts to generate video.adapters.generated.ts instead of video.services.generated.ts
- Updates all import statements to use new filename
- Removes unnecessary mock exports from bookingScenario.ts (FAKE_DAILY_CREDENTIAL, etc.)
- Addresses GitHub comments from @keithwillcode on PR #23435

The terminology change from 'services map' to 'adapters map' better reflects
the actual content (video adapters, not services) and maintains consistency
with the established refactoring pattern.

Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>

* refactor: rename videoServices to videoAdapters and simplify return statement

- Rename variable from videoServices to videoAdapters for consistency
- Remove unnecessary const variable and return directly in same line
- Addresses GitHub comments from @keithwillcode on PR #23435

Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2025-08-29 14:21:05 +09:00
..
2025-03-20 21:30:51 -03:00
2025-03-20 21:30:51 -03:00