Scheduling infrastructure for absolutely everyone.
chore: format calendar events to remove oauthClientIds (#21040)
Morgan31b1f31d8260
diff --git a/apps/api/v2/package.json b/apps/api/v2/package.jsonindex e61061c6b08..6a004e5e4f0 100644--- a/apps/api/v2/package.json+++ b/apps/api/v2/package.json@@ -38,7 +38,7 @@"@axiomhq/winston": "^1.2.0","@calcom/platform-constants": "*","@calcom/platform-enums": "*",- "@calcom/platform-libraries": "npm:@calcom/[email protected]",+ "@calcom/platform-libraries": "npm:@calcom/[email protected]","@calcom/platform-libraries-0.0.2": "npm:@calcom/[email protected]","@calcom/platform-types": "*","@calcom/platform-utils": "*",diff --git a/packages/app-store/office365calendar/lib/CalendarService.ts b/packages/app-store/office365calendar/lib/CalendarService.tsindex edc6a418a28..3e6765f1533 100644--- a/packages/app-store/office365calendar/lib/CalendarService.ts+++ b/packages/app-store/office365calendar/lib/CalendarService.ts@@ -8,6 +8,7 @@ import {CalendarAppDelegationCredentialConfigurationError,} from "@calcom/lib/CalendarAppError";import { handleErrorsJson, handleErrorsRaw } from "@calcom/lib/errors";+import { formatCalEvent } from "@calcom/lib/formatCalendarEvent";import logger from "@calcom/lib/logger";import type { BufferedBusyTime } from "@calcom/types/BufferedBusyTime";import type {@@ -249,9 +250,10 @@ export default class Office365CalendarService implements Calendar {? `${await this.getUserEndpoint()}/calendars/${mainHostDestinationCalendar?.externalId}/events`: `${await this.getUserEndpoint()}/calendar/events`;+ const formattedEvent = formatCalEvent(event);const response = await this.fetcher(eventsUrl, {method: "POST",- body: JSON.stringify(this.translateEvent(event)),+ body: JSON.stringify(this.translateEvent(formattedEvent)),});const responseJson = await handleErrorsJson<NewCalendarEventType & { iCalUId: string }>(response);diff --git a/packages/lib/CalendarService.ts b/packages/lib/CalendarService.tsindex 957a8e7958b..88d764363ca 100644--- a/packages/lib/CalendarService.ts+++ b/packages/lib/CalendarService.ts@@ -32,6 +32,7 @@ import type { CredentialPayload } from "@calcom/types/Credential";import { getLocation, getRichDescription } from "./CalEventParser";import { symmetricDecrypt } from "./crypto";+import { formatCalEvent } from "./formatCalendarEvent";import logger from "./logger";const TIMEZONE_FORMAT = "YYYY-MM-DDTHH:mm:ss[Z]";@@ -139,10 +140,10 @@ export default abstract class BaseCalendarService implements Calendar {return attendees;}- async createEvent(event: CalendarEvent, credentialId: number): Promise<NewCalendarEventType> {+ async createEvent(eventRaw: CalendarEvent, credentialId: number): Promise<NewCalendarEventType> {try {- const calendars = await this.listCalendars(event);-+ const calendars = await this.listCalendars(eventRaw);+ const event = formatCalEvent(eventRaw);const uid = uuidv4();// We create local ICS files