@pipedream/google_calendar 0.3.15 → 0.3.17

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.
@@ -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 { v4 as uuidv4 } from "uuid";
3
4
 
4
5
  export default {
5
6
  key: "google_calendar-create-event",
6
7
  name: "Create Event",
7
8
  description: "Create an event to the Google Calendar. [See the documentation](https://googleapis.dev/nodejs/googleapis/latest/calendar/classes/Resource$Events.html#insert)",
8
- version: "0.1.6",
9
+ version: "0.1.7",
9
10
  type: "action",
10
11
  props: {
11
12
  googleCalendar,
@@ -15,6 +16,12 @@ export default {
15
16
  "calendarId",
16
17
  ],
17
18
  },
19
+ createMeetRoom: {
20
+ label: "Create Meet Room",
21
+ description: "Create a Google Meet room for this event.",
22
+ type: "boolean",
23
+ optional: true,
24
+ },
18
25
  ...createEventCommon.props({
19
26
  isUpdate: false,
20
27
  }),
@@ -26,7 +33,7 @@ export default {
26
33
  const timeZone = this.getTimeZone(this.timeZone);
27
34
  const attendees = this.formatAttendees(this.attendees);
28
35
 
29
- const response = await this.googleCalendar.createEvent({
36
+ const data = {
30
37
  calendarId: this.calendarId,
31
38
  sendUpdates: this.sendUpdates,
32
39
  sendNotifications: this.sendNotifications,
@@ -44,7 +51,21 @@ export default {
44
51
  }),
45
52
  attendees,
46
53
  },
47
- });
54
+ };
55
+
56
+ if (this.createMeetRoom) {
57
+ data.conferenceDataVersion = 1;
58
+ data.resource.conferenceData = {
59
+ createRequest: {
60
+ requestId: uuidv4(),
61
+ conferenceSolutionKey: {
62
+ type: "hangoutsMeet",
63
+ },
64
+ },
65
+ };
66
+ }
67
+
68
+ const response = await this.googleCalendar.createEvent(data);
48
69
 
49
70
  $.export("$summary", `Successfully created event: "${response.id}"`);
50
71
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/google_calendar",
3
- "version": "0.3.15",
3
+ "version": "0.3.17",
4
4
  "description": "Pipedream Google_calendar Components",
5
5
  "main": "google_calendar.app.mjs",
6
6
  "keywords": [
@@ -2,25 +2,14 @@ import googleCalendar from "../../google_calendar.app.mjs";
2
2
  import { DEFAULT_POLLING_SOURCE_TIMER_INTERVAL } from "@pipedream/platform";
3
3
 
4
4
  export default {
5
- props: ({ useCalendarId }) => {
6
- const props = {
7
- googleCalendar,
8
- timer: {
9
- type: "$.interface.timer",
10
- default: {
11
- intervalSeconds: DEFAULT_POLLING_SOURCE_TIMER_INTERVAL,
12
- },
5
+ props: {
6
+ googleCalendar,
7
+ timer: {
8
+ type: "$.interface.timer",
9
+ default: {
10
+ intervalSeconds: DEFAULT_POLLING_SOURCE_TIMER_INTERVAL,
13
11
  },
14
- };
15
- if (useCalendarId) {
16
- props.calendarId = {
17
- propDefinition: [
18
- googleCalendar,
19
- "calendarId",
20
- ],
21
- };
22
- }
23
- return props;
12
+ },
24
13
  },
25
14
  hooks: {
26
15
  async activate() {
@@ -5,13 +5,17 @@ export default {
5
5
  key: "google_calendar-event-cancelled",
6
6
  name: "New Cancelled Event",
7
7
  description: "Emit new event when a Google Calendar event is cancelled or deleted",
8
- version: "0.1.4",
8
+ version: "0.1.5",
9
9
  type: "source",
10
10
  dedupe: "unique",
11
11
  props: {
12
- ...common.props({
13
- useCalendarId: true,
14
- }),
12
+ ...common.props,
13
+ calendarId: {
14
+ propDefinition: [
15
+ common.props.googleCalendar,
16
+ "calendarId",
17
+ ],
18
+ },
15
19
  },
16
20
  methods: {
17
21
  ...common.methods,
@@ -5,13 +5,17 @@ export default {
5
5
  key: "google_calendar-event-ended",
6
6
  name: "New Ended Event",
7
7
  description: "Emit new event when a Google Calendar event ends",
8
- version: "0.1.4",
8
+ version: "0.1.5",
9
9
  type: "source",
10
10
  dedupe: "unique",
11
11
  props: {
12
- ...common.props({
13
- useCalendarId: true,
14
- }),
12
+ ...common.props,
13
+ calendarId: {
14
+ propDefinition: [
15
+ common.props.googleCalendar,
16
+ "calendarId",
17
+ ],
18
+ },
15
19
  },
16
20
  methods: {
17
21
  ...common.methods,
@@ -6,23 +6,41 @@ export default {
6
6
  key: "google_calendar-event-start",
7
7
  name: "New Event Start",
8
8
  description: "Emit new event when the specified time before the Google Calendar event starts",
9
- version: "0.1.5",
9
+ version: "0.1.6",
10
10
  type: "source",
11
11
  dedupe: "unique",
12
12
  props: {
13
- ...common.props({
14
- useCalendarId: true,
15
- }),
13
+ ...common.props,
14
+ calendarId: {
15
+ propDefinition: [
16
+ common.props.googleCalendar,
17
+ "calendarId",
18
+ ],
19
+ },
20
+ minutesBefore: {
21
+ type: "integer",
22
+ label: "Minutes Before",
23
+ description: "Emit the event this many minutes before the event starts",
24
+ default: 5,
25
+ },
16
26
  },
17
27
  methods: {
18
28
  ...common.methods,
29
+ getMillisecondsBefore() {
30
+ return +this.minutesBefore * 60 * 1000;
31
+ },
19
32
  getConfig({
20
- intervalMs, now,
33
+ now, intervalMs,
21
34
  }) {
22
- const timeMin = now.toISOString();
35
+ const {
36
+ getMillisecondsBefore,
37
+ calendarId,
38
+ } = this;
39
+
40
+ const timeMin = new Date(now.getTime() - getMillisecondsBefore()).toISOString();
23
41
  const timeMax = new Date(now.getTime() + intervalMs).toISOString();
24
42
  return {
25
- calendarId: this.calendarId,
43
+ calendarId,
26
44
  timeMax,
27
45
  timeMin,
28
46
  singleEvents: true,
@@ -30,12 +48,12 @@ export default {
30
48
  };
31
49
  },
32
50
  isRelevant(event, {
33
- intervalMs, now,
51
+ now, intervalMs,
34
52
  }) {
35
- const eventStart = event?.start?.dateTime;
36
- const start = new Date(eventStart);
53
+ const start = new Date(event?.start?.dateTime);
37
54
  const msFromStart = start.getTime() - now.getTime();
38
- return eventStart && msFromStart > 0 && msFromStart < intervalMs;
55
+ return msFromStart > 0
56
+ && msFromStart < (this.getMillisecondsBefore() + intervalMs);
39
57
  },
40
58
  },
41
59
  sampleEmit,
@@ -4,12 +4,10 @@ export default {
4
4
  key: "google_calendar-new-calendar",
5
5
  name: "New Calendar Created",
6
6
  description: "Emit new event when a calendar is created.",
7
- version: "0.1.4",
7
+ version: "0.1.5",
8
8
  type: "source",
9
9
  props: {
10
- ...common.props({
11
- useCalendarId: false,
12
- }),
10
+ ...common.props,
13
11
  db: "$.service.db",
14
12
  },
15
13
  hooks: {
@@ -5,13 +5,17 @@ export default {
5
5
  key: "google_calendar-new-event",
6
6
  name: "New Event Created",
7
7
  description: "Emit new event when a Google Calendar event is created",
8
- version: "0.1.4",
8
+ version: "0.1.5",
9
9
  type: "source",
10
10
  dedupe: "unique",
11
11
  props: {
12
- ...common.props({
13
- useCalendarId: true,
14
- }),
12
+ ...common.props,
13
+ calendarId: {
14
+ propDefinition: [
15
+ common.props.googleCalendar,
16
+ "calendarId",
17
+ ],
18
+ },
15
19
  },
16
20
  methods: {
17
21
  ...common.methods,
@@ -5,16 +5,20 @@ 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.4",
8
+ version: "0.1.5",
9
9
  type: "source",
10
10
  dedupe: "unique",
11
11
  props: {
12
- ...common.props({
13
- useCalendarId: true,
14
- }),
12
+ ...common.props,
13
+ calendarId: {
14
+ propDefinition: [
15
+ common.props.googleCalendar,
16
+ "calendarId",
17
+ ],
18
+ },
15
19
  q: {
16
20
  propDefinition: [
17
- common.props({}).googleCalendar,
21
+ common.props.googleCalendar,
18
22
  "q",
19
23
  ],
20
24
  },
@@ -5,13 +5,17 @@ export default {
5
5
  key: "google_calendar-new-or-updated-event",
6
6
  name: "New Created or Updated Event",
7
7
  description: "Emit new event when a Google Calendar events is created or updated (does not emit cancelled events)",
8
- version: "0.1.4",
8
+ version: "0.1.5",
9
9
  type: "source",
10
10
  dedupe: "unique",
11
11
  props: {
12
- ...common.props({
13
- useCalendarId: true,
14
- }),
12
+ ...common.props,
13
+ calendarId: {
14
+ propDefinition: [
15
+ common.props.googleCalendar,
16
+ "calendarId",
17
+ ],
18
+ },
15
19
  },
16
20
  methods: {
17
21
  ...common.methods,