refactor: extract NextRequest from handle new booking (#20082)

* extract NextRequest

* update api and tests

* booking limits tests

* fix more tests to use new approach

* update more tests with new format

* extract getOrgDomainConfig to not use req

* extract req from loadNewUsers and pass in hostname/forcedSlug

* fix instant meeting types and hostname fixes

* fix handleNewBookingReq

* fix type errors in tests

* make hostName and forcedSlug optional

* fix type err

* Revert "fix type err"

This reverts commit 9d5de9019d9dafe348c97b876baaa1d0675967e5.

* wip fix e2e

* fix: add missing headers

* migrate handle recurring event and also create tests specific to fn

* platform recurringbooking

* fix type

* hard code types on request object

* bump libraries

* fixup! bump libraries

* fix: accessing host if headers not passed

* fix: v2 recurring booking

* fix: accessing host if headers not passed

* chore: bump platform libraries

* fix tests

* push

* chore: bump libraries

* push lock changes

* bump libraries

---------

Co-authored-by: amrit <[email protected]>
Co-authored-by: Morgan <[email protected]>
Co-authored-by: Morgan Vernay <[email protected]>
Co-authored-by: supalarry <[email protected]>
Co-authored-by: Lauris Skraucis <[email protected]>
This commit is contained in:
authored and GitHub committed 2025-04-02 17:57:58 -04:00
1 parent 4db3c592e5
commit 417a612aa3
27 files changed
+1301 -785

No files matched your search

@@ -52,6 +52,34 @@ export function getOrgSlug(hostname: string, forcedSlug?: string) {
return null;
}
export function getOrgDomainConfig({
hostname,
fallback,
forcedSlug,
isPlatform,
}: {
hostname: string;
fallback?: string | string[];
forcedSlug?: string;
isPlatform?: boolean;
}) {
if (isPlatform && forcedSlug) {
return {
isValidOrgDomain: true,
currentOrgDomain: forcedSlug,
};
}
return getOrgDomainConfigFromHostname({
hostname,
fallback,
forcedSlug,
});
}
/**
* @deprecated Use `getOrgDomainConfig` instead. To be removed in a future release. getOrgDomainConfig is more flexible and can be used without next request.
*/
export function orgDomainConfig(req: IncomingMessage | undefined, fallback?: string | string[]) {
const forPlatform = isPlatformRequest(req);
const forcedSlugHeader = req?.headers?.["x-cal-force-slug"];