Files
cal.diy/packages/features/bookings/lib/getAllCredentialsForUsersOnEvent/refreshCredentials.ts
T
bec83b2342 chore: remove TRPC barrel exports (#19598)
* remove barrel export for client

* fix more imports

* remove server barrel

* remove more barrel exporst and fix tssconfig

* fix types

* fix imports for removed barrels

* fig ssg createserverside helpers

* restore lock

* new yarn lock

* remove barel exports

* remove barrel

* replace client with react in tsconfig

* fix yarn lock

* Update exports for trpc to not be types

* add ENDPOINTS export to the correct location

* other exports fixes lost due to barrel

* fix client error export

* more imports

---------

Co-authored-by: hbjORbj <[email protected]>
Co-authored-by: Keith Williams <[email protected]>
2025-03-03 15:33:32 -03:00

22 lines
942 B
TypeScript

import async from "async";
import { isDwdCredential } from "@calcom/lib/domainWideDelegation/clientAndServer";
import { buildAllCredentials } from "@calcom/lib/domainWideDelegation/server";
import type { CredentialForCalendarService } from "@calcom/types/Credential";
import { refreshCredential } from "./refreshCredential";
/**
* Refreshes the given set of credentials.
*
* @param credentials
*/
export async function refreshCredentials(
credentials: Array<CredentialForCalendarService>
): Promise<Array<CredentialForCalendarService>> {
const nonDwdCredentials = credentials.filter((cred) => !isDwdCredential({ credentialId: cred.id }));
const dwdCredentials = credentials.filter((cred) => isDwdCredential({ credentialId: cred.id }));
const refreshedDbCredentials = await async.mapLimit(nonDwdCredentials, 5, refreshCredential);
return buildAllCredentials({ dwdCredentials, existingCredentials: refreshedDbCredentials });
}