diff --git a/components/google_calendar/actions/add-attendees-to-event/add-attendees-to-event.mjs b/components/google_calendar/actions/add-attendees-to-event/add-attendees-to-event.mjs index e5c35d8b56929..7c4e455c853c3 100644 --- a/components/google_calendar/actions/add-attendees-to-event/add-attendees-to-event.mjs +++ b/components/google_calendar/actions/add-attendees-to-event/add-attendees-to-event.mjs @@ -5,7 +5,7 @@ export default { key: "google_calendar-add-attendees-to-event", name: "Add Attendees To Event", description: "Add attendees to an existing event. [See the documentation](https://googleapis.dev/nodejs/googleapis/latest/calendar/classes/Resource$Events.html#update)", - version: "0.0.1", + version: "0.0.2", type: "action", props: { googleCalendar, diff --git a/components/google_calendar/actions/create-event/create-event.mjs b/components/google_calendar/actions/create-event/create-event.mjs index 3fc896da09e0e..6470edf1f05e0 100644 --- a/components/google_calendar/actions/create-event/create-event.mjs +++ b/components/google_calendar/actions/create-event/create-event.mjs @@ -7,7 +7,7 @@ export default { key: "google_calendar-create-event", name: "Create Event", description: "Create an event in a Google Calendar. [See the documentation](https://developers.google.com/calendar/api/v3/reference/events/insert)", - version: "0.2.3", + version: "0.2.4", type: "action", props: { googleCalendar, diff --git a/components/google_calendar/actions/delete-event/delete-event.mjs b/components/google_calendar/actions/delete-event/delete-event.mjs index b7742dcafb304..c5887e5f79205 100644 --- a/components/google_calendar/actions/delete-event/delete-event.mjs +++ b/components/google_calendar/actions/delete-event/delete-event.mjs @@ -4,7 +4,7 @@ export default { key: "google_calendar-delete-event", name: "Delete an Event", description: "Delete an event from a Google Calendar. [See the documentation](https://googleapis.dev/nodejs/googleapis/latest/calendar/classes/Resource$Events.html#delete)", - version: "0.1.5", + version: "0.1.6", type: "action", props: { googleCalendar, diff --git a/components/google_calendar/actions/get-calendar/get-calendar.mjs b/components/google_calendar/actions/get-calendar/get-calendar.mjs index ae1dd066cf8fb..76c70d6596fb5 100644 --- a/components/google_calendar/actions/get-calendar/get-calendar.mjs +++ b/components/google_calendar/actions/get-calendar/get-calendar.mjs @@ -4,7 +4,7 @@ export default { key: "google_calendar-get-calendar", name: "Retrieve Calendar Details", description: "Retrieve calendar details of a Google Calendar. [See the documentation](https://googleapis.dev/nodejs/googleapis/latest/calendar/classes/Resource$Calendars.html#get)", - version: "0.1.6", + version: "0.1.7", type: "action", props: { googleCalendar, diff --git a/components/google_calendar/actions/get-event/get-event.mjs b/components/google_calendar/actions/get-event/get-event.mjs index df80989ae5f03..6c944d0d7af1e 100644 --- a/components/google_calendar/actions/get-event/get-event.mjs +++ b/components/google_calendar/actions/get-event/get-event.mjs @@ -4,7 +4,7 @@ export default { key: "google_calendar-get-event", name: "Retrieve Event Details", description: "Retrieve event details from Google Calendar. [See the documentation](https://googleapis.dev/nodejs/googleapis/latest/calendar/classes/Resource$Events.html#get)", - version: "0.1.6", + version: "0.1.7", type: "action", props: { googleCalendar, diff --git a/components/google_calendar/actions/list-calendars/list-calendars.mjs b/components/google_calendar/actions/list-calendars/list-calendars.mjs index d345f0d92bac7..c9e07b17073d7 100644 --- a/components/google_calendar/actions/list-calendars/list-calendars.mjs +++ b/components/google_calendar/actions/list-calendars/list-calendars.mjs @@ -4,7 +4,7 @@ export default { key: "google_calendar-list-calendars", name: "List Calendars", description: "Retrieve a list of calendars from Google Calendar. [See the documentation](https://googleapis.dev/nodejs/googleapis/latest/calendar/classes/Resource$Calendarlist.html#list)", - version: "0.1.6", + version: "0.1.7", type: "action", props: { googleCalendar, diff --git a/components/google_calendar/actions/list-events/list-events.mjs b/components/google_calendar/actions/list-events/list-events.mjs index 7df8b2d767952..6c1796aebd35e 100644 --- a/components/google_calendar/actions/list-events/list-events.mjs +++ b/components/google_calendar/actions/list-events/list-events.mjs @@ -6,7 +6,7 @@ export default { key: "google_calendar-list-events", name: "List Events", description: "Retrieve a list of event from the Google Calendar. [See the documentation](https://developers.google.com/calendar/api/v3/reference/events/list)", - version: "0.0.6", + version: "0.0.7", type: "action", props: { googleCalendar, diff --git a/components/google_calendar/actions/query-free-busy-calendars/query-free-busy-calendars.mjs b/components/google_calendar/actions/query-free-busy-calendars/query-free-busy-calendars.mjs index c2f397fd80766..5ecdfddc5244f 100644 --- a/components/google_calendar/actions/query-free-busy-calendars/query-free-busy-calendars.mjs +++ b/components/google_calendar/actions/query-free-busy-calendars/query-free-busy-calendars.mjs @@ -4,7 +4,7 @@ export default { key: "google_calendar-query-free-busy-calendars", name: "Retrieve Free/Busy Calendar Details", description: "Retrieve free/busy calendar details from Google Calendar. [See the documentation](https://googleapis.dev/nodejs/googleapis/latest/calendar/classes/Resource$Freebusy.html#query)", - version: "0.1.6", + version: "0.1.7", type: "action", props: { googleCalendar, diff --git a/components/google_calendar/actions/quick-add-event/quick-add-event.mjs b/components/google_calendar/actions/quick-add-event/quick-add-event.mjs index 12395e526f52a..bdacef99c7e2b 100644 --- a/components/google_calendar/actions/quick-add-event/quick-add-event.mjs +++ b/components/google_calendar/actions/quick-add-event/quick-add-event.mjs @@ -5,7 +5,7 @@ export default { key: "google_calendar-quick-add-event", name: "Add Quick Event", description: "Create a quick event to the Google Calendar. [See the documentation](https://googleapis.dev/nodejs/googleapis/latest/calendar/classes/Resource$Events.html#quickAdd)", - version: "0.1.5", + version: "0.1.6", type: "action", props: { googleCalendar, diff --git a/components/google_calendar/actions/update-event/update-event.mjs b/components/google_calendar/actions/update-event/update-event.mjs index c06dca261b6c2..b8583faa1f5a1 100644 --- a/components/google_calendar/actions/update-event/update-event.mjs +++ b/components/google_calendar/actions/update-event/update-event.mjs @@ -6,7 +6,7 @@ export default { key: "google_calendar-update-event", name: "Update Event", description: "Update an event from Google Calendar. [See the documentation](https://googleapis.dev/nodejs/googleapis/latest/calendar/classes/Resource$Events.html#update)", - version: "0.0.8", + version: "0.0.9", type: "action", props: { googleCalendar, diff --git a/components/google_calendar/google_calendar.app.mjs b/components/google_calendar/google_calendar.app.mjs index 1f6f6d54ddea6..4aa42ec1f1670 100644 --- a/components/google_calendar/google_calendar.app.mjs +++ b/components/google_calendar/google_calendar.app.mjs @@ -296,6 +296,27 @@ export default { auth, }); }, + retryWithExponentialBackoff(func, maxAttempts = 3, baseDelayS = 2) { + let attempt = 0; + + const execute = async () => { + try { + return await func(); + } catch (error) { + if (attempt >= maxAttempts) { + throw error; + } + + const delayMs = Math.pow(baseDelayS, attempt) * 1000; + await new Promise((resolve) => setTimeout(resolve, delayMs)); + + attempt++; + return execute(); + } + }; + + return execute(); + }, async requestHandler({ api, method, args = {}, }) { @@ -305,7 +326,8 @@ export default { } = args; try { const calendar = this.client(); - const response = await calendar[api][method](otherArgs); + const fn = () => calendar[api][method](otherArgs); + const response = await this.retryWithExponentialBackoff(fn); return returnOnlyData ? response.data : response; @@ -454,6 +476,9 @@ export default { args, }); }, + // Used to get the nextSyncToken. Since we don't need + // to actually retrieve any events, we set "updatedMin" + // to the current timestamp async fullSync(calendarId) { let nextSyncToken = null; let nextPageToken = null; @@ -462,6 +487,8 @@ export default { await this.listEvents({ calendarId, pageToken: nextPageToken, + orderBy: "updated", + updatedMin: new Date().toISOString(), }); nextPageToken = syncResp?.nextPageToken; nextSyncToken = syncResp?.nextSyncToken; diff --git a/components/google_calendar/package.json b/components/google_calendar/package.json index 4d80d781b1eb6..5fb12b964b966 100644 --- a/components/google_calendar/package.json +++ b/components/google_calendar/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/google_calendar", - "version": "0.5.4", + "version": "0.5.5", "description": "Pipedream Google_calendar Components", "main": "google_calendar.app.mjs", "keywords": [ diff --git a/components/google_calendar/sources/event-cancelled/event-cancelled.mjs b/components/google_calendar/sources/event-cancelled/event-cancelled.mjs index 52b4c9096035a..2793f18236110 100644 --- a/components/google_calendar/sources/event-cancelled/event-cancelled.mjs +++ b/components/google_calendar/sources/event-cancelled/event-cancelled.mjs @@ -6,7 +6,7 @@ export default { key: "google_calendar-event-cancelled", name: "New Cancelled Event", description: "Emit new event when a Google Calendar event is cancelled or deleted", - version: "0.1.9", + version: "0.1.10", type: "source", dedupe: "unique", props: { diff --git a/components/google_calendar/sources/event-ended/event-ended.mjs b/components/google_calendar/sources/event-ended/event-ended.mjs index 7e97c5182f921..61649f1cb7ffe 100644 --- a/components/google_calendar/sources/event-ended/event-ended.mjs +++ b/components/google_calendar/sources/event-ended/event-ended.mjs @@ -6,7 +6,7 @@ export default { key: "google_calendar-event-ended", name: "New Ended Event", description: "Emit new event when a Google Calendar event ends", - version: "0.1.9", + version: "0.1.10", type: "source", dedupe: "unique", props: { diff --git a/components/google_calendar/sources/new-calendar/new-calendar.mjs b/components/google_calendar/sources/new-calendar/new-calendar.mjs index b70a5f1716c81..e68ba327e018c 100644 --- a/components/google_calendar/sources/new-calendar/new-calendar.mjs +++ b/components/google_calendar/sources/new-calendar/new-calendar.mjs @@ -5,7 +5,7 @@ export default { key: "google_calendar-new-calendar", name: "New Calendar Created", description: "Emit new event when a calendar is created.", - version: "0.1.9", + version: "0.1.10", type: "source", dedupe: "unique", props: { diff --git a/components/google_calendar/sources/new-event-search/new-event-search.mjs b/components/google_calendar/sources/new-event-search/new-event-search.mjs index ef9e90d8f4243..374ababff2691 100644 --- a/components/google_calendar/sources/new-event-search/new-event-search.mjs +++ b/components/google_calendar/sources/new-event-search/new-event-search.mjs @@ -5,7 +5,7 @@ export default { key: "google_calendar-new-event-search", name: "New Event Matching a Search", description: "Emit new event when a Google Calendar event is created that matches a search", - version: "0.1.9", + version: "0.1.10", type: "source", dedupe: "unique", props: { diff --git a/components/google_calendar/sources/new-or-updated-event-instant/new-or-updated-event-instant.mjs b/components/google_calendar/sources/new-or-updated-event-instant/new-or-updated-event-instant.mjs index 61cdfd4cb20f8..b4d4db70e7757 100644 --- a/components/google_calendar/sources/new-or-updated-event-instant/new-or-updated-event-instant.mjs +++ b/components/google_calendar/sources/new-or-updated-event-instant/new-or-updated-event-instant.mjs @@ -8,7 +8,7 @@ export default { type: "source", name: "New Created or Updated Event (Instant)", description: "Emit new event when a Google Calendar events is created or updated (does not emit cancelled events)", - version: "0.1.12", + version: "0.1.13", dedupe: "unique", props: { googleCalendar, @@ -265,6 +265,7 @@ export default { calendarId, syncToken, pageToken: nextPageToken, + maxResults: 2500, }); if (syncStatus === 410) { console.log("Sync token invalid, resyncing"); diff --git a/components/google_calendar/sources/upcoming-event-alert/upcoming-event-alert.mjs b/components/google_calendar/sources/upcoming-event-alert/upcoming-event-alert.mjs index cc1b50596b3c6..5aacdd5b009d3 100644 --- a/components/google_calendar/sources/upcoming-event-alert/upcoming-event-alert.mjs +++ b/components/google_calendar/sources/upcoming-event-alert/upcoming-event-alert.mjs @@ -8,7 +8,7 @@ export default { description: `Emit new event based on a time interval before an upcoming event in the calendar. This source uses Pipedream's Task Scheduler. [See the documentation](https://pipedream.com/docs/examples/waiting-to-execute-next-step-of-workflow/#step-1-create-a-task-scheduler-event-source) for more information and instructions for connecting your Pipedream account.`, - version: "0.0.7", + version: "0.0.8", type: "source", props: { pipedream: taskScheduler.props.pipedream,