@pipedream/google_calendar 0.5.3 → 0.5.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,7 +5,7 @@ export default {
5
5
  key: "google_calendar-add-attendees-to-event",
6
6
  name: "Add Attendees To Event",
7
7
  description: "Add attendees to an existing event. [See the documentation](https://googleapis.dev/nodejs/googleapis/latest/calendar/classes/Resource$Events.html#update)",
8
- version: "0.0.1",
8
+ version: "0.0.2",
9
9
  type: "action",
10
10
  props: {
11
11
  googleCalendar,
@@ -7,7 +7,7 @@ export default {
7
7
  key: "google_calendar-create-event",
8
8
  name: "Create Event",
9
9
  description: "Create an event in a Google Calendar. [See the documentation](https://developers.google.com/calendar/api/v3/reference/events/insert)",
10
- version: "0.2.3",
10
+ version: "0.2.4",
11
11
  type: "action",
12
12
  props: {
13
13
  googleCalendar,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "google_calendar-delete-event",
5
5
  name: "Delete an Event",
6
6
  description: "Delete an event from a Google Calendar. [See the documentation](https://googleapis.dev/nodejs/googleapis/latest/calendar/classes/Resource$Events.html#delete)",
7
- version: "0.1.5",
7
+ version: "0.1.6",
8
8
  type: "action",
9
9
  props: {
10
10
  googleCalendar,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "google_calendar-get-calendar",
5
5
  name: "Retrieve Calendar Details",
6
6
  description: "Retrieve calendar details of a Google Calendar. [See the documentation](https://googleapis.dev/nodejs/googleapis/latest/calendar/classes/Resource$Calendars.html#get)",
7
- version: "0.1.6",
7
+ version: "0.1.7",
8
8
  type: "action",
9
9
  props: {
10
10
  googleCalendar,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "google_calendar-get-event",
5
5
  name: "Retrieve Event Details",
6
6
  description: "Retrieve event details from Google Calendar. [See the documentation](https://googleapis.dev/nodejs/googleapis/latest/calendar/classes/Resource$Events.html#get)",
7
- version: "0.1.6",
7
+ version: "0.1.7",
8
8
  type: "action",
9
9
  props: {
10
10
  googleCalendar,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "google_calendar-list-calendars",
5
5
  name: "List Calendars",
6
6
  description: "Retrieve a list of calendars from Google Calendar. [See the documentation](https://googleapis.dev/nodejs/googleapis/latest/calendar/classes/Resource$Calendarlist.html#list)",
7
- version: "0.1.6",
7
+ version: "0.1.7",
8
8
  type: "action",
9
9
  props: {
10
10
  googleCalendar,
@@ -6,7 +6,7 @@ export default {
6
6
  key: "google_calendar-list-events",
7
7
  name: "List Events",
8
8
  description: "Retrieve a list of event from the Google Calendar. [See the documentation](https://developers.google.com/calendar/api/v3/reference/events/list)",
9
- version: "0.0.6",
9
+ version: "0.0.7",
10
10
  type: "action",
11
11
  props: {
12
12
  googleCalendar,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "google_calendar-query-free-busy-calendars",
5
5
  name: "Retrieve Free/Busy Calendar Details",
6
6
  description: "Retrieve free/busy calendar details from Google Calendar. [See the documentation](https://googleapis.dev/nodejs/googleapis/latest/calendar/classes/Resource$Freebusy.html#query)",
7
- version: "0.1.6",
7
+ version: "0.1.7",
8
8
  type: "action",
9
9
  props: {
10
10
  googleCalendar,
@@ -5,7 +5,7 @@ export default {
5
5
  key: "google_calendar-quick-add-event",
6
6
  name: "Add Quick Event",
7
7
  description: "Create a quick event to the Google Calendar. [See the documentation](https://googleapis.dev/nodejs/googleapis/latest/calendar/classes/Resource$Events.html#quickAdd)",
8
- version: "0.1.5",
8
+ version: "0.1.6",
9
9
  type: "action",
10
10
  props: {
11
11
  googleCalendar,
@@ -6,7 +6,7 @@ export default {
6
6
  key: "google_calendar-update-event",
7
7
  name: "Update Event",
8
8
  description: "Update an event from Google Calendar. [See the documentation](https://googleapis.dev/nodejs/googleapis/latest/calendar/classes/Resource$Events.html#update)",
9
- version: "0.0.8",
9
+ version: "0.0.9",
10
10
  type: "action",
11
11
  props: {
12
12
  googleCalendar,
@@ -296,6 +296,27 @@ export default {
296
296
  auth,
297
297
  });
298
298
  },
299
+ retryWithExponentialBackoff(func, maxAttempts = 3, baseDelayS = 2) {
300
+ let attempt = 0;
301
+
302
+ const execute = async () => {
303
+ try {
304
+ return await func();
305
+ } catch (error) {
306
+ if (attempt >= maxAttempts) {
307
+ throw error;
308
+ }
309
+
310
+ const delayMs = Math.pow(baseDelayS, attempt) * 1000;
311
+ await new Promise((resolve) => setTimeout(resolve, delayMs));
312
+
313
+ attempt++;
314
+ return execute();
315
+ }
316
+ };
317
+
318
+ return execute();
319
+ },
299
320
  async requestHandler({
300
321
  api, method, args = {},
301
322
  }) {
@@ -305,7 +326,8 @@ export default {
305
326
  } = args;
306
327
  try {
307
328
  const calendar = this.client();
308
- const response = await calendar[api][method](otherArgs);
329
+ const fn = () => calendar[api][method](otherArgs);
330
+ const response = await this.retryWithExponentialBackoff(fn);
309
331
  return returnOnlyData
310
332
  ? response.data
311
333
  : response;
@@ -454,6 +476,9 @@ export default {
454
476
  args,
455
477
  });
456
478
  },
479
+ // Used to get the nextSyncToken. Since we don't need
480
+ // to actually retrieve any events, we set "updatedMin"
481
+ // to the current timestamp
457
482
  async fullSync(calendarId) {
458
483
  let nextSyncToken = null;
459
484
  let nextPageToken = null;
@@ -462,6 +487,8 @@ export default {
462
487
  await this.listEvents({
463
488
  calendarId,
464
489
  pageToken: nextPageToken,
490
+ orderBy: "updated",
491
+ updatedMin: new Date().toISOString(),
465
492
  });
466
493
  nextPageToken = syncResp?.nextPageToken;
467
494
  nextSyncToken = syncResp?.nextSyncToken;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/google_calendar",
3
- "version": "0.5.3",
3
+ "version": "0.5.5",
4
4
  "description": "Pipedream Google_calendar Components",
5
5
  "main": "google_calendar.app.mjs",
6
6
  "keywords": [
@@ -50,7 +50,7 @@ export default {
50
50
  const config = this.getConfig(intervalData);
51
51
  const resp = await this.googleCalendar.listEvents(config);
52
52
 
53
- const events = resp?.data?.items;
53
+ const events = resp?.data?.items || resp?.items;
54
54
  if (!Array.isArray(events)) {
55
55
  console.log("nothing to emit");
56
56
  return;
@@ -6,7 +6,7 @@ export default {
6
6
  key: "google_calendar-event-cancelled",
7
7
  name: "New Cancelled Event",
8
8
  description: "Emit new event when a Google Calendar event is cancelled or deleted",
9
- version: "0.1.8",
9
+ version: "0.1.10",
10
10
  type: "source",
11
11
  dedupe: "unique",
12
12
  props: {
@@ -6,7 +6,7 @@ export default {
6
6
  key: "google_calendar-event-ended",
7
7
  name: "New Ended Event",
8
8
  description: "Emit new event when a Google Calendar event ends",
9
- version: "0.1.8",
9
+ version: "0.1.10",
10
10
  type: "source",
11
11
  dedupe: "unique",
12
12
  props: {
@@ -5,7 +5,7 @@ export default {
5
5
  key: "google_calendar-new-calendar",
6
6
  name: "New Calendar Created",
7
7
  description: "Emit new event when a calendar is created.",
8
- version: "0.1.8",
8
+ version: "0.1.10",
9
9
  type: "source",
10
10
  dedupe: "unique",
11
11
  props: {
@@ -5,7 +5,7 @@ export default {
5
5
  key: "google_calendar-new-event-search",
6
6
  name: "New Event Matching a Search",
7
7
  description: "Emit new event when a Google Calendar event is created that matches a search",
8
- version: "0.1.8",
8
+ version: "0.1.10",
9
9
  type: "source",
10
10
  dedupe: "unique",
11
11
  props: {
@@ -8,7 +8,7 @@ export default {
8
8
  type: "source",
9
9
  name: "New Created or Updated Event (Instant)",
10
10
  description: "Emit new event when a Google Calendar events is created or updated (does not emit cancelled events)",
11
- version: "0.1.12",
11
+ version: "0.1.13",
12
12
  dedupe: "unique",
13
13
  props: {
14
14
  googleCalendar,
@@ -265,6 +265,7 @@ export default {
265
265
  calendarId,
266
266
  syncToken,
267
267
  pageToken: nextPageToken,
268
+ maxResults: 2500,
268
269
  });
269
270
  if (syncStatus === 410) {
270
271
  console.log("Sync token invalid, resyncing");
@@ -8,7 +8,7 @@ export default {
8
8
  description: `Emit new event based on a time interval before an upcoming event in the calendar. This source uses Pipedream's Task Scheduler.
9
9
  [See the documentation](https://pipedream.com/docs/examples/waiting-to-execute-next-step-of-workflow/#step-1-create-a-task-scheduler-event-source)
10
10
  for more information and instructions for connecting your Pipedream account.`,
11
- version: "0.0.7",
11
+ version: "0.0.8",
12
12
  type: "source",
13
13
  props: {
14
14
  pipedream: taskScheduler.props.pipedream,