-
Notifications
You must be signed in to change notification settings - Fork 0
Async import of the appStore packages #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: appstore-sync-refactor-base
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,63 +1,33 @@ | ||
| // import * as example from "./_example"; | ||
| import * as applecalendar from "./applecalendar"; | ||
| import * as caldavcalendar from "./caldavcalendar"; | ||
| import * as closecom from "./closecom"; | ||
| import * as dailyvideo from "./dailyvideo"; | ||
| import * as exchange2013calendar from "./exchange2013calendar"; | ||
| import * as exchange2016calendar from "./exchange2016calendar"; | ||
| import * as exchangecalendar from "./exchangecalendar"; | ||
| import * as facetime from "./facetime"; | ||
| import * as giphy from "./giphy"; | ||
| import * as googlecalendar from "./googlecalendar"; | ||
| import * as googlevideo from "./googlevideo"; | ||
| import * as hubspot from "./hubspot"; | ||
| import * as huddle01video from "./huddle01video"; | ||
| import * as jitsivideo from "./jitsivideo"; | ||
| import * as larkcalendar from "./larkcalendar"; | ||
| import * as office365calendar from "./office365calendar"; | ||
| import * as office365video from "./office365video"; | ||
| import * as plausible from "./plausible"; | ||
| import * as salesforce from "./salesforce"; | ||
| import * as sendgrid from "./sendgrid"; | ||
| import * as stripepayment from "./stripepayment"; | ||
| import * as sylapsvideo from "./sylapsvideo"; | ||
| import * as tandemvideo from "./tandemvideo"; | ||
| import * as vital from "./vital"; | ||
| import * as wipemycalother from "./wipemycalother"; | ||
| import * as zapier from "./zapier"; | ||
| import * as zohocrm from "./zohocrm"; | ||
| import * as zoomvideo from "./zoomvideo"; | ||
|
|
||
| const appStore = { | ||
| // example, | ||
| applecalendar, | ||
| caldavcalendar, | ||
| closecom, | ||
| dailyvideo, | ||
| googlecalendar, | ||
| googlevideo, | ||
| hubspot, | ||
| huddle01video, | ||
| jitsivideo, | ||
| sylapsvideo, | ||
| larkcalendar, | ||
| office365calendar, | ||
| office365video, | ||
| plausible, | ||
| salesforce, | ||
| zohocrm, | ||
| sendgrid, | ||
| stripepayment, | ||
| tandemvideo, | ||
| vital, | ||
| zoomvideo, | ||
| wipemycalother, | ||
| giphy, | ||
| zapier, | ||
| exchange2013calendar, | ||
| exchange2016calendar, | ||
| exchangecalendar, | ||
| facetime, | ||
| // example: import("./example"), | ||
| applecalendar: import("./applecalendar"), | ||
| caldavcalendar: import("./caldavcalendar"), | ||
| closecom: import("./closecom"), | ||
| dailyvideo: import("./dailyvideo"), | ||
| googlecalendar: import("./googlecalendar"), | ||
| googlevideo: import("./googlevideo"), | ||
| hubspot: import("./hubspot"), | ||
| huddle01video: import("./huddle01video"), | ||
| jitsivideo: import("./jitsivideo"), | ||
| larkcalendar: import("./larkcalendar"), | ||
| office365calendar: import("./office365calendar"), | ||
| office365video: import("./office365video"), | ||
| plausible: import("./plausible"), | ||
| salesforce: import("./salesforce"), | ||
| zohocrm: import("./zohocrm"), | ||
| sendgrid: import("./sendgrid"), | ||
| stripepayment: import("./stripepayment"), | ||
| tandemvideo: import("./tandemvideo"), | ||
| vital: import("./vital"), | ||
| zoomvideo: import("./zoomvideo"), | ||
| wipemycalother: import("./wipemycalother"), | ||
| giphy: import("./giphy"), | ||
| zapier: import("./zapier"), | ||
| exchange2013calendar: import("./exchange2013calendar"), | ||
| exchange2016calendar: import("./exchange2016calendar"), | ||
| exchangecalendar: import("./exchangecalendar"), | ||
| facetime: import("./facetime"), | ||
| sylapsvideo: import("./sylapsvideo"), | ||
| }; | ||
|
|
||
| export default appStore; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -122,10 +122,10 @@ const Reschedule = async (bookingUid: string, cancellationReason: string) => { | |
| (ref) => !!credentialsMap.get(ref.type) | ||
| ); | ||
| try { | ||
| bookingRefsFiltered.forEach((bookingRef) => { | ||
| bookingRefsFiltered.forEach(async (bookingRef) => { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion: As in the other reschedule handler, the async callback passed to Severity Level: Critical 🚨- ❌ /api/integrations/wipemycalother/wipe may leave events active.
- ❌ Vital webhook rescheduling may not cancel external events.
- ⚠️ Errors from deleteEvent/deleteMeeting bypass intended logging.
- ⚠️ Reschedule resolves before calendar/video deletions complete. |
||
| if (bookingRef.uid) { | ||
| if (bookingRef.type.endsWith("_calendar")) { | ||
| const calendar = getCalendar(credentialsMap.get(bookingRef.type)); | ||
| const calendar = await getCalendar(credentialsMap.get(bookingRef.type)); | ||
| return calendar?.deleteEvent(bookingRef.uid, builder.calendarEvent); | ||
| } else if (bookingRef.type.endsWith("_video")) { | ||
| return deleteMeeting(credentialsMap.get(bookingRef.type), bookingRef.uid); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -240,7 +240,7 @@ async function handler(req: CustomRequest) { | |
| integrationsToDelete.push(deleteMeeting(credential, reference.uid)); | ||
| } | ||
| if (reference.type.includes("_calendar")) { | ||
| const calendar = getCalendar(credential); | ||
| const calendar = await getCalendar(credential); | ||
| if (calendar) { | ||
| integrationsToDelete.push( | ||
| calendar?.deleteEvent(reference.uid, evt, reference.externalCalendarId) | ||
|
|
@@ -262,7 +262,7 @@ async function handler(req: CustomRequest) { | |
| ); | ||
| } | ||
| if (reference.type.includes("_calendar")) { | ||
| const calendar = getCalendar(credential); | ||
| const calendar = await getCalendar(credential); | ||
| if (calendar) { | ||
| integrationsToDelete.push( | ||
| calendar?.updateEvent(reference.uid, updatedEvt, reference.externalCalendarId) | ||
|
|
@@ -449,7 +449,7 @@ async function handler(req: CustomRequest) { | |
| (credential) => credential.id === credentialId | ||
| ); | ||
| if (calendarCredential) { | ||
| const calendar = getCalendar(calendarCredential); | ||
| const calendar = await getCalendar(calendarCredential); | ||
| if ( | ||
| bookingToDelete.eventType?.recurringEvent && | ||
| bookingToDelete.recurringEventId && | ||
|
|
@@ -458,7 +458,7 @@ async function handler(req: CustomRequest) { | |
| bookingToDelete.user.credentials | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion: In the recurring calendar cancellation path, the use of Severity Level: Critical 🚨- ❌ /api/cancel leaves recurring calendar events partially undeleted.
- ⚠️ Calendar integrations show outdated events after cancellation. |
||
| .filter((credential) => credential.type.endsWith("_calendar")) | ||
| .forEach(async (credential) => { | ||
| const calendar = getCalendar(credential); | ||
| const calendar = await getCalendar(credential); | ||
| for (const updBooking of updatedBookings) { | ||
| const bookingRef = updBooking.references.find((ref) => ref.type.includes("_calendar")); | ||
| if (bookingRef) { | ||
|
|
@@ -474,12 +474,13 @@ async function handler(req: CustomRequest) { | |
| } | ||
| } else { | ||
| // For bookings made before the refactor we go through the old behaviour of running through each calendar credential | ||
| bookingToDelete.user.credentials | ||
| .filter((credential) => credential.type.endsWith("_calendar")) | ||
| .forEach((credential) => { | ||
| const calendar = getCalendar(credential); | ||
| apiDeletes.push(calendar?.deleteEvent(uid, evt, externalCalendarId) as Promise<unknown>); | ||
| }); | ||
| const calendarCredentials = bookingToDelete.user.credentials.filter((credential) => | ||
| credential.type.endsWith("_calendar") | ||
| ); | ||
| for (const credential of calendarCredentials) { | ||
| const calendar = await getCalendar(credential); | ||
| apiDeletes.push(calendar?.deleteEvent(uid, evt, externalCalendarId) as Promise<unknown>); | ||
| } | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -585,7 +586,7 @@ async function handler(req: CustomRequest) { | |
| } | ||
|
|
||
| // Posible to refactor TODO: | ||
| const paymentApp = appStore[paymentAppCredential?.app?.dirName as keyof typeof appStore]; | ||
| const paymentApp = await appStore[paymentAppCredential?.app?.dirName as keyof typeof appStore]; | ||
| if (!(paymentApp && "lib" in paymentApp && "PaymentService" in paymentApp.lib)) { | ||
| console.warn(`payment App service of type ${paymentApp} is not implemented`); | ||
| return null; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: The async callback passed to
forEachis never awaited, so calendar/video deletions may still be in progress (or throw unhandled promise rejections) after the function continues, and the surrounding try/catch will not catch any errors from the awaited operations inside the callback. [logic error]Severity Level: Critical 🚨
Steps of Reproduction ✅
Prompt for AI Agent 🤖