@pipedream/google_calendar 0.5.2 → 0.5.4

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.
Files changed (32) hide show
  1. package/README.md +7 -16
  2. package/actions/{update-event-attendees/update-event-attendees.mjs → add-attendees-to-event/add-attendees-to-event.mjs} +11 -25
  3. package/actions/common/create-event-common.mjs +76 -33
  4. package/actions/create-event/create-event.mjs +110 -12
  5. package/actions/delete-event/delete-event.mjs +2 -2
  6. package/actions/get-calendar/get-calendar.mjs +1 -1
  7. package/actions/get-event/get-event.mjs +1 -1
  8. package/actions/list-calendars/list-calendars.mjs +4 -2
  9. package/actions/list-events/list-events.mjs +22 -19
  10. package/actions/query-free-busy-calendars/query-free-busy-calendars.mjs +1 -1
  11. package/actions/quick-add-event/quick-add-event.mjs +22 -3
  12. package/actions/update-event/update-event.mjs +33 -5
  13. package/common/constants.mjs +8 -0
  14. package/google_calendar.app.mjs +33 -64
  15. package/package.json +3 -2
  16. package/sources/common/common.mjs +3 -3
  17. package/sources/event-cancelled/event-cancelled.mjs +3 -1
  18. package/sources/event-cancelled/test-event.mjs +31 -0
  19. package/sources/event-ended/event-ended.mjs +3 -1
  20. package/sources/event-ended/test-event.mjs +31 -0
  21. package/sources/new-calendar/new-calendar.mjs +4 -1
  22. package/sources/new-calendar/test-event.mjs +18 -0
  23. package/sources/new-event-search/new-event-search.mjs +2 -2
  24. package/sources/new-or-updated-event-instant/new-or-updated-event-instant.mjs +1 -1
  25. package/sources/upcoming-event-alert/test-event.mjs +32 -0
  26. package/sources/upcoming-event-alert/upcoming-event-alert.mjs +17 -26
  27. package/actions/list-events-by-type/list-events-by-type.mjs +0 -56
  28. package/sources/event-start/event-start.mjs +0 -60
  29. package/sources/event-start/test-event.mjs +0 -32
  30. package/sources/new-event/new-event.mjs +0 -36
  31. package/sources/new-or-updated-event/new-or-updated-event.mjs +0 -48
  32. package/sources/upcoming-event-type-alert/upcoming-event-type-alert.mjs +0 -149
@@ -1,11 +1,12 @@
1
1
  import googleCalendar from "../../google_calendar.app.mjs";
2
2
  import createEventCommon from "../common/create-event-common.mjs";
3
+ import constants from "../../common/constants.mjs";
3
4
 
4
5
  export default {
5
6
  key: "google_calendar-update-event",
6
7
  name: "Update Event",
7
8
  description: "Update an event from Google Calendar. [See the documentation](https://googleapis.dev/nodejs/googleapis/latest/calendar/classes/Resource$Events.html#update)",
8
- version: "0.0.7",
9
+ version: "0.0.8",
9
10
  type: "action",
10
11
  props: {
11
12
  googleCalendar,
@@ -27,6 +28,28 @@ export default {
27
28
  ...createEventCommon.props({
28
29
  isUpdate: true,
29
30
  }),
31
+ timeZone: {
32
+ propDefinition: [
33
+ googleCalendar,
34
+ "timeZone",
35
+ ],
36
+ },
37
+ sendUpdates: {
38
+ propDefinition: [
39
+ googleCalendar,
40
+ "sendUpdates",
41
+ ],
42
+ },
43
+ },
44
+ async additionalProps(props) {
45
+ if (this.repeatFrequency) {
46
+ const frequency = constants.REPEAT_FREQUENCIES[this.repeatFrequency];
47
+ props.repeatInterval.description = `Enter 1 to "repeat every ${frequency}", enter 2 to "repeat every other ${frequency}", etc. Defaults to 1.`;
48
+ }
49
+ props.repeatInterval.hidden = !this.repeatFrequency;
50
+ props.repeatUntil.hidden = !this.repeatFrequency;
51
+ props.repeatTimes.hidden = !this.repeatFrequency;
52
+ return {};
30
53
  },
31
54
  methods: {
32
55
  ...createEventCommon.methods,
@@ -39,25 +62,30 @@ export default {
39
62
 
40
63
  const timeZone = await this.getTimeZone(this.timeZone || currentEvent.start.timeZone);
41
64
  const attendees = this.formatAttendees(this.attendees, currentEvent.attendees);
65
+ const recurrence = this.formatRecurrence({
66
+ repeatFrequency: this.repeatFrequency,
67
+ repeatInterval: this.repeatInterval,
68
+ repeatTimes: this.repeatTimes,
69
+ repeatUntil: this.repeatUntil,
70
+ });
42
71
 
43
72
  const response = await this.googleCalendar.updateEvent({
44
73
  calendarId: this.calendarId,
45
74
  eventId: this.eventId,
46
75
  sendUpdates: this.sendUpdates,
47
- sendNotifications: this.sendNotifications,
48
76
  requestBody: {
49
77
  summary: this.summary || currentEvent.summary,
50
78
  location: this.location || currentEvent.location,
51
79
  description: this.description || currentEvent.description,
52
80
  start: this.getDateParam({
53
- date: this.eventStartDate || currentEvent.start.dateTime,
81
+ date: this.eventStartDate || currentEvent.start.dateTime || currentEvent.start.date,
54
82
  timeZone: timeZone || currentEvent.start.timeZone,
55
83
  }),
56
84
  end: this.getDateParam({
57
- date: this.eventEndDate || currentEvent.end.dateTime,
85
+ date: this.eventEndDate || currentEvent.end.dateTime || currentEvent.start.date,
58
86
  timeZone: timeZone || currentEvent.end.timeZone,
59
87
  }),
60
- recurrence: this.recurrence,
88
+ recurrence,
61
89
  attendees,
62
90
  },
63
91
  });
@@ -78,6 +78,14 @@ const API = {
78
78
  },
79
79
  };
80
80
 
81
+ const REPEAT_FREQUENCIES = {
82
+ DAILY: "day",
83
+ WEEKLY: "week",
84
+ MONTHLY: "month",
85
+ YEARLY: "year",
86
+ };
87
+
81
88
  export default {
82
89
  API,
90
+ REPEAT_FREQUENCIES,
83
91
  };
@@ -1,6 +1,7 @@
1
1
  import timezones from "moment-timezone";
2
2
  import calendar from "@googleapis/calendar";
3
3
  import constants from "./common/constants.mjs";
4
+ import { closest } from "color-2-name";
4
5
 
5
6
  export default {
6
7
  type: "app",
@@ -36,27 +37,27 @@ export default {
36
37
  label: "Event ID",
37
38
  type: "string",
38
39
  description: "Select an event from Google Calendar.",
39
- async options({
40
- calendarId, prevContext,
41
- }) {
42
- const { nextPageToken } = prevContext;
43
- if (nextPageToken === false) {
44
- return [];
45
- }
40
+ async options({ calendarId }) {
41
+ const monthAgo = new Date(new Date().setMonth(new Date().getMonth() - 1)).toISOString();
46
42
  const response = await this.listEvents({
47
43
  calendarId,
48
- pageToken: nextPageToken,
44
+ maxResults: 100,
45
+ timeMin: monthAgo,
49
46
  });
50
- const options = response.items.map((item) => ({
51
- label: item.summary,
52
- value: item.id,
53
- }));
54
- return {
55
- options,
56
- context: {
57
- nextPageToken: response.nextPageToken ?? false,
58
- },
59
- };
47
+ const options = response.items.map((item) => {
48
+ let label = item.summary || item.id;
49
+ const date = item.start && (item.start.date
50
+ ? item.start.date
51
+ : item.start.dateTime.slice(0, 10));
52
+ if (date) {
53
+ label += ` - ${date}`;
54
+ }
55
+ return {
56
+ label,
57
+ value: item.id,
58
+ };
59
+ });
60
+ return options.reverse();
60
61
  },
61
62
  },
62
63
  iCalUID: {
@@ -66,20 +67,20 @@ export default {
66
67
  type: "string",
67
68
  },
68
69
  maxAttendees: {
69
- label: "Max attendees",
70
+ label: "Max Attendees",
70
71
  description: "The maximum number of attendees to include in the response. If there are more than the specified number of attendees, only the participant is returned. Optional.",
71
72
  optional: true,
72
73
  type: "integer",
73
74
  },
74
75
  maxResults: {
75
- label: "Max results",
76
+ label: "Max Results",
76
77
  description: "Maximum number of events returned on one result page. The number of events in the resulting page may be less than this value, or none at all, even if there are more events matching the query. Incomplete pages can be detected by a non-empty nextPageToken field in the response. By default the value is 250 events. The page size can never be larger than 2500 events. Optional.",
77
78
  optional: true,
78
79
  type: "integer",
79
80
  },
80
81
  orderBy: {
81
- label: "Order by",
82
- description: "The order of the events returned in the result. Optional. The default is an unspecified, stable order.",
82
+ label: "Order By",
83
+ description: "The order of the events returned in the result. Optional. The default is an unspecified, stable order. Must set Single Events to `true` to order by `startTime`.",
83
84
  optional: true,
84
85
  type: "string",
85
86
  options: [
@@ -94,12 +95,6 @@ export default {
94
95
  ],
95
96
  default: "startTime",
96
97
  },
97
- pageToken: {
98
- label: "Page token",
99
- description: "Token specifying which result page to return. Optional.",
100
- optional: true,
101
- type: "string",
102
- },
103
98
  privateExtendedProperty: {
104
99
  label: "Private extended property",
105
100
  description: "Extended properties constraint specified as propertyName=value. Matches only private properties. This parameter might be repeated multiple times to return events that match all given constraints.",
@@ -113,37 +108,37 @@ export default {
113
108
  type: "string",
114
109
  },
115
110
  sharedExtendedProperty: {
116
- label: "Shared extended property",
111
+ label: "Shared Extended Property",
117
112
  description: "Extended properties constraint specified as propertyName=value. Matches only shared properties. This parameter might be repeated multiple times to return events that match all given constraints.",
118
113
  optional: true,
119
114
  type: "string",
120
115
  },
121
116
  showDeleted: {
122
- label: "Show deleted",
117
+ label: "Show Deleted",
123
118
  description: "Whether to include deleted events (with status equals \"cancelled\") in the result. Cancelled instances of recurring events (but not the underlying recurring event) will still be included if showDeleted and singleEvents are both False. If showDeleted and singleEvents are both True, only single instances of deleted events (but not the underlying recurring events) are returned. Optional. The default is False.",
124
119
  optional: true,
125
120
  type: "boolean",
126
121
  },
127
122
  showHiddenInvitations: {
128
- label: "Show hidden invitations",
123
+ label: "Show Hidden Invitations",
129
124
  description: "Whether to include hidden invitations in the result. Optional. The default is False.",
130
125
  optional: true,
131
126
  type: "boolean",
132
127
  },
133
128
  singleEvents: {
134
- label: "Single events",
129
+ label: "Single Events",
135
130
  description: "Whether to expand recurring events into instances and only return single one-off events and instances of recurring events, but not the underlying recurring events themselves. Optional. The default is False.",
136
131
  optional: true,
137
132
  type: "boolean",
138
133
  },
139
134
  syncToken: {
140
- label: "Sync token",
135
+ label: "Sync Token",
141
136
  description: "Token obtained from the nextSyncToken field returned on the last page of results from the previous list request. It makes the result of this list request contain only entries that have changed since then. All events deleted since the previous list request will always be in the result set and it is not allowed to set showDeleted to False.",
142
137
  optional: true,
143
138
  type: "string",
144
139
  },
145
140
  timeMax: {
146
- label: "Max time",
141
+ label: "Max Time",
147
142
  description: "Upper bound (exclusive) for an event's time to filter by. Must be an RFC3339 timestamp with mandatory time zone offset, for example, 2011-06-03T10:00:00-07:00, 2011-06-03T10:00:00Z. Milliseconds may be provided but are ignored. Must be greater than Min Time.",
148
143
  optional: true,
149
144
  type: "string",
@@ -170,13 +165,13 @@ export default {
170
165
  },
171
166
  },
172
167
  updatedMin: {
173
- label: "Minimum updated time",
168
+ label: "Minimum Updated Time",
174
169
  description: "Lower bound for an event's last modification time (as a RFC3339 timestamp) to filter by. When specified, entries deleted since this time will always be included regardless of showDeleted. Optional. The default is not to filter by last modification time.",
175
170
  optional: true,
176
171
  type: "string",
177
172
  },
178
173
  ruleId: {
179
- label: "ACL rule identifier",
174
+ label: "ACL Rule Identifier",
180
175
  type: "string",
181
176
  description: "ACL rule identifier.",
182
177
  async options({
@@ -255,16 +250,10 @@ export default {
255
250
  "none",
256
251
  ],
257
252
  },
258
- sendNotifications: {
259
- label: "Send Notifications",
260
- type: "boolean",
261
- description: "Whether to send notifications about the event update",
262
- optional: true,
263
- },
264
253
  colorId: {
265
254
  label: "Color ID",
266
255
  type: "string",
267
- description: "The color of the event. This is an ID referring to an entry in the event section of the colors definition (see the colors endpoint).",
256
+ description: "The color assigned to this event on your calendar. You can only select a color from the list of event colors provided from your calendar. This setting will only affect your calendar.",
268
257
  optional: true,
269
258
  async options() {
270
259
  const response = await this.listColors();
@@ -272,7 +261,7 @@ export default {
272
261
  key,
273
262
  value,
274
263
  ]) => ({
275
- label: `Background ${value.background} | Foreground ${value.foreground}`,
264
+ label: `${closest(value.background).name} (${value.background})`,
276
265
  value: key,
277
266
  }));
278
267
  },
@@ -297,26 +286,6 @@ export default {
297
286
  refresh_token: this?.$auth?.oauth_refresh_token,
298
287
  };
299
288
  },
300
- async calendarList() {
301
- const calendar = this.client();
302
- return calendar.calendarList.list();
303
- },
304
- async list(config) {
305
- const calendar = this.client();
306
- return calendar.events.list(config);
307
- },
308
- // for config key value pairs - https://developers.google.com/calendar/v3/reference/events/list
309
- async getEvents(config) {
310
- return this.list(config);
311
- },
312
- async watch(config) {
313
- const calendar = this.client();
314
- return calendar.events.watch(config);
315
- },
316
- async stop(config) {
317
- const calendar = this.client();
318
- return calendar.channels.stop(config);
319
- },
320
289
  client() {
321
290
  const auth = new calendar.auth.OAuth2();
322
291
  auth.setCredentials({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/google_calendar",
3
- "version": "0.5.2",
3
+ "version": "0.5.4",
4
4
  "description": "Pipedream Google_calendar Components",
5
5
  "main": "google_calendar.app.mjs",
6
6
  "keywords": [
@@ -11,7 +11,8 @@
11
11
  "author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
12
12
  "dependencies": {
13
13
  "@googleapis/calendar": "^1.0.2",
14
- "@pipedream/platform": "^1.6.0",
14
+ "@pipedream/platform": "^3.0.0",
15
+ "color-2-name": "^1.4.4",
15
16
  "lodash.get": "^4.4.2",
16
17
  "moment-timezone": "^0.5.33",
17
18
  "uuid": "^8.3.2"
@@ -40,7 +40,7 @@ export default {
40
40
  start,
41
41
  } = event;
42
42
  return {
43
- summary,
43
+ summary: summary || `Event ID: ${id}`,
44
44
  id,
45
45
  ts: +new Date(start.dateTime),
46
46
  };
@@ -48,9 +48,9 @@ export default {
48
48
  async processEvents(event) {
49
49
  const intervalData = this.getIntervalData(event);
50
50
  const config = this.getConfig(intervalData);
51
- const resp = await this.googleCalendar.getEvents(config);
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;
@@ -1,11 +1,12 @@
1
1
  import common from "../common/common.mjs";
2
+ import sampleEmit from "./test-event.mjs";
2
3
 
3
4
  export default {
4
5
  ...common,
5
6
  key: "google_calendar-event-cancelled",
6
7
  name: "New Cancelled Event",
7
8
  description: "Emit new event when a Google Calendar event is cancelled or deleted",
8
- version: "0.1.7",
9
+ version: "0.1.9",
9
10
  type: "source",
10
11
  dedupe: "unique",
11
12
  props: {
@@ -35,4 +36,5 @@ export default {
35
36
  return event.status === "cancelled";
36
37
  },
37
38
  },
39
+ sampleEmit,
38
40
  };
@@ -0,0 +1,31 @@
1
+ export default {
2
+ "kind": "calendar#event",
3
+ "etag": "\"3442821871082000\"",
4
+ "id": "7aefibs2i2chltfk626kbtse91",
5
+ "status": "cancelled",
6
+ "htmlLink": "https://www.google.com/calendar/event?eid=N2FlZmliczJpMmNobHRmgcjA0bGJ0NDhhbmgyNmdvNmlzajRyZm1qbDBAZw",
7
+ "created": "2024-07-19T17:41:08.000Z",
8
+ "updated": "2024-07-19T17:42:15.541Z",
9
+ "summary": "test event",
10
+ "creator": {
11
+ "email": "test@sample.com"
12
+ },
13
+ "organizer": {
14
+ "email": "r04l6isj4rfmjl0@group.calendar.google.com",
15
+ "displayName": "Test",
16
+ "self": true
17
+ },
18
+ "start": {
19
+ "date": "2024-07-20"
20
+ },
21
+ "end": {
22
+ "date": "2024-07-21"
23
+ },
24
+ "transparency": "transparent",
25
+ "iCalUID": "7aefibs2i2c6kbtse91@google.com",
26
+ "sequence": 1,
27
+ "reminders": {
28
+ "useDefault": false
29
+ },
30
+ "eventType": "default"
31
+ }
@@ -1,11 +1,12 @@
1
1
  import common from "../common/common.mjs";
2
+ import sampleEmit from "./test-event.mjs";
2
3
 
3
4
  export default {
4
5
  ...common,
5
6
  key: "google_calendar-event-ended",
6
7
  name: "New Ended Event",
7
8
  description: "Emit new event when a Google Calendar event ends",
8
- version: "0.1.7",
9
+ version: "0.1.9",
9
10
  type: "source",
10
11
  dedupe: "unique",
11
12
  props: {
@@ -41,4 +42,5 @@ export default {
41
42
  return eventEnd && msFromEnd > 0 && msFromEnd < intervalMs;
42
43
  },
43
44
  },
45
+ sampleEmit,
44
46
  };
@@ -0,0 +1,31 @@
1
+ export default {
2
+ "kind": "calendar#event",
3
+ "etag": "\"3442822827690000\"",
4
+ "id": "4pkio0bslskikpvqqo0pol763n",
5
+ "status": "confirmed",
6
+ "htmlLink": "https://www.google.com/calendar/event?eid=N3B2cXFvMHBvbDc2M24gcjA0bGJ0NDhhbmgyNmdvNmlzajRyZm1qbDBAZw",
7
+ "created": "2024-07-19T17:50:13.000Z",
8
+ "updated": "2024-07-19T17:50:13.845Z",
9
+ "creator": {
10
+ "email": "test@sample.com"
11
+ },
12
+ "organizer": {
13
+ "email": "r04lbt6isj4rfmjl0@group.calendar.google.com",
14
+ "displayName": "Test",
15
+ "self": true
16
+ },
17
+ "start": {
18
+ "dateTime": "2024-07-19T13:50:00-04:00",
19
+ "timeZone": "America/Detroit"
20
+ },
21
+ "end": {
22
+ "dateTime": "2024-07-19T13:55:00-04:00",
23
+ "timeZone": "America/Detroit"
24
+ },
25
+ "iCalUID": "4pkio0bqo0pol763n@google.com",
26
+ "sequence": 0,
27
+ "reminders": {
28
+ "useDefault": true
29
+ },
30
+ "eventType": "default"
31
+ }
@@ -1,11 +1,13 @@
1
1
  import common from "../common/common.mjs";
2
+ import sampleEmit from "./test-event.mjs";
2
3
 
3
4
  export default {
4
5
  key: "google_calendar-new-calendar",
5
6
  name: "New Calendar Created",
6
7
  description: "Emit new event when a calendar is created.",
7
- version: "0.1.7",
8
+ version: "0.1.9",
8
9
  type: "source",
10
+ dedupe: "unique",
9
11
  props: {
10
12
  ...common.props,
11
13
  db: "$.service.db",
@@ -58,4 +60,5 @@ export default {
58
60
  const calendarIds = calendars.map((item) => item.id);
59
61
  this.setCalendarIds(calendarIds);
60
62
  },
63
+ sampleEmit,
61
64
  };
@@ -0,0 +1,18 @@
1
+ export default {
2
+ "kind": "calendar#calendarListEntry",
3
+ "etag": "\"1721410772595000\"",
4
+ "id": "r04lbtisj4rfmjl0@group.calendar.google.com",
5
+ "summary": "Test",
6
+ "timeZone": "America/Detroit",
7
+ "colorId": "7",
8
+ "backgroundColor": "#42d692",
9
+ "foregroundColor": "#000000",
10
+ "selected": true,
11
+ "accessRole": "owner",
12
+ "defaultReminders": [],
13
+ "conferenceProperties": {
14
+ "allowedConferenceSolutionTypes": [
15
+ "hangoutsMeet"
16
+ ]
17
+ }
18
+ }
@@ -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.7",
8
+ version: "0.1.9",
9
9
  type: "source",
10
10
  dedupe: "unique",
11
11
  props: {
@@ -37,7 +37,7 @@ export default {
37
37
  },
38
38
  isRelevant(event, { past }) {
39
39
  const created = new Date(event.created);
40
- // created in last 5 mins and not cancelled
40
+ // created since last run and not cancelled
41
41
  return created > past && event.status !== "cancelled";
42
42
  },
43
43
  },
@@ -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.11",
11
+ version: "0.1.12",
12
12
  dedupe: "unique",
13
13
  props: {
14
14
  googleCalendar,
@@ -0,0 +1,32 @@
1
+ export default {
2
+ "kind": "calendar#event",
3
+ "etag": "\"3442838491454000\"",
4
+ "id": "0dip62r3f3d85o35jjnjcmqbmo",
5
+ "status": "confirmed",
6
+ "htmlLink": "https://www.google.com/calendar/event?eid=MGRpcDYycjNW8zNWgbWljaGVsbGUucGlwZWRyZWFtQG0",
7
+ "created": "2024-07-19T20:00:45.000Z",
8
+ "updated": "2024-07-19T20:00:45.727Z",
9
+ "summary": "test",
10
+ "creator": {
11
+ "email": "test@sample.com",
12
+ "self": true
13
+ },
14
+ "organizer": {
15
+ "email": "test@sample.com",
16
+ "self": true
17
+ },
18
+ "start": {
19
+ "dateTime": "2024-07-19T16:07:00-04:00",
20
+ "timeZone": "America/Detroit"
21
+ },
22
+ "end": {
23
+ "dateTime": "2024-07-19T17:07:00-04:00",
24
+ "timeZone": "America/Detroit"
25
+ },
26
+ "iCalUID": "0dip62r35jjnjcmqbmo@google.com",
27
+ "sequence": 0,
28
+ "reminders": {
29
+ "useDefault": true
30
+ },
31
+ "eventType": "default"
32
+ }
@@ -1,5 +1,6 @@
1
1
  import taskScheduler from "../../../pipedream/sources/new-scheduled-tasks/new-scheduled-tasks.mjs";
2
2
  import googleCalendar from "../../google_calendar.app.mjs";
3
+ import sampleEmit from "./test-event.mjs";
3
4
 
4
5
  export default {
5
6
  key: "google_calendar-upcoming-event-alert",
@@ -7,7 +8,7 @@ export default {
7
8
  description: `Emit new event based on a time interval before an upcoming event in the calendar. This source uses Pipedream's Task Scheduler.
8
9
  [See the documentation](https://pipedream.com/docs/examples/waiting-to-execute-next-step-of-workflow/#step-1-create-a-task-scheduler-event-source)
9
10
  for more information and instructions for connecting your Pipedream account.`,
10
- version: "0.0.6",
11
+ version: "0.0.7",
11
12
  type: "source",
12
13
  props: {
13
14
  pipedream: taskScheduler.props.pipedream,
@@ -20,15 +21,11 @@ export default {
20
21
  "calendarId",
21
22
  ],
22
23
  },
23
- eventId: {
24
+ eventTypes: {
24
25
  propDefinition: [
25
26
  googleCalendar,
26
- "eventId",
27
- (c) => ({
28
- calendarId: c.calendarId,
29
- }),
27
+ "eventTypes",
30
28
  ],
31
- optional: true,
32
29
  },
33
30
  time: {
34
31
  type: "integer",
@@ -95,26 +92,19 @@ export default {
95
92
  const calendarEvents = [];
96
93
  const params = {
97
94
  calendarId: this.calendarId,
95
+ eventTypes: this.eventTypes,
98
96
  };
99
- if (this.eventId) {
100
- const item = await this.googleCalendar.getEvent({
101
- ...params,
102
- eventId: this.eventId,
103
- });
104
- calendarEvents.push(item);
105
- } else {
106
- do {
107
- const {
108
- data: {
109
- items, nextPageToken,
110
- },
111
- } = await this.googleCalendar.getEvents(params);
112
- if (items?.length) {
113
- calendarEvents.push(...items);
114
- }
115
- params.pageToken = nextPageToken;
116
- } while (params.pageToken);
117
- }
97
+ do {
98
+ const {
99
+ data: {
100
+ items, nextPageToken,
101
+ },
102
+ } = await this.googleCalendar.listEvents(params);
103
+ if (items?.length) {
104
+ calendarEvents.push(...items);
105
+ }
106
+ params.pageToken = nextPageToken;
107
+ } while (params.pageToken);
118
108
  return calendarEvents;
119
109
  },
120
110
  },
@@ -157,4 +147,5 @@ export default {
157
147
  this._setScheduledEventIds(scheduledEventIds);
158
148
  this._setScheduledCalendarEventIds(scheduledCalendarEventIds);
159
149
  },
150
+ sampleEmit,
160
151
  };