@pipedream/google_calendar 0.3.5 → 0.3.6

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.
@@ -0,0 +1,137 @@
1
+ import googleCalendar from "../../google_calendar.app.mjs";
2
+
3
+ export default {
4
+ key: "google_calendar-update-event",
5
+ name: "Update Event",
6
+ description: "Update an event to the Google Calendar. [See the docs here](https://googleapis.dev/nodejs/googleapis/latest/calendar/classes/Resource$Events.html#update)",
7
+ version: "0.0.1",
8
+ type: "action",
9
+ props: {
10
+ googleCalendar,
11
+ calendarId: {
12
+ propDefinition: [
13
+ googleCalendar,
14
+ "calendarId",
15
+ ],
16
+ },
17
+ eventId: {
18
+ propDefinition: [
19
+ googleCalendar,
20
+ "eventId",
21
+ (c) => ({
22
+ calendarId: c.calendarId,
23
+ }),
24
+ ],
25
+ },
26
+ summary: {
27
+ label: "Event Title",
28
+ type: "string",
29
+ description: "Enter static text (e.g., `hello world`) for the event name",
30
+ optional: true,
31
+ },
32
+ location: {
33
+ label: "Event Venue",
34
+ type: "string",
35
+ description: "Enter static text (e.g., `hello world`) for the event venue",
36
+ optional: true,
37
+ },
38
+ description: {
39
+ label: "Event Description",
40
+ type: "string",
41
+ description: "Enter detailed event description",
42
+ optional: true,
43
+ },
44
+ attendees: {
45
+ label: "Attendees",
46
+ type: "string[]",
47
+ description: "Enter the EmailId of the attendees",
48
+ optional: true,
49
+ },
50
+ eventStartDate: {
51
+ label: "Event Date",
52
+ type: "string",
53
+ description: "For all-day events, enter the Event day in the format 'yyyy-mm-dd'. For events with time, format according to [RFC3339](https://www.rfc-editor.org/rfc/rfc3339.html#section-1): 'yyyy-mm-ddThh:mm:ss+01:00'. A time zone offset is required unless a time zone is explicitly specified in timeZone.",
54
+ },
55
+ eventEndDate: {
56
+ label: "Event End Date",
57
+ type: "string",
58
+ description: "For all-day events, enter the Event day in the format 'yyyy-mm-dd'. For events with time, format according to [RFC3339](https://www.rfc-editor.org/rfc/rfc3339.html#section-1): 'yyyy-mm-ddThh:mm:ss+01:00'. A time zone offset is required unless a time zone is explicitly specified in timeZone.",
59
+ },
60
+ sendUpdates: {
61
+ label: "Send Updates",
62
+ type: "string",
63
+ description: "Whether to send notifications about the creation of the new event.",
64
+ optional: true,
65
+ options: [
66
+ "all",
67
+ "externalOnly",
68
+ "none",
69
+ ],
70
+ },
71
+ timeZone: {
72
+ propDefinition: [
73
+ googleCalendar,
74
+ "timeZone",
75
+ ],
76
+ },
77
+ },
78
+ async run({ $ }) {
79
+ /**
80
+ * Based on the IINA Time Zone DB
81
+ * http://www.iana.org/time-zones
82
+ */
83
+ const { value: timeZone } = this.timeZone ?? await this.googleCalendar.getSettings({
84
+ setting: "timezone",
85
+ });
86
+
87
+ /**
88
+ * Format for the attendees
89
+ *
90
+ * [
91
+ * { "email": "lpage@example.com",},
92
+ * { "email": "sbrin@example.com",},
93
+ * ]
94
+ */
95
+
96
+ let attendees = [];
97
+
98
+ if (this.attendees && Array.isArray(this.attendees)) {
99
+ attendees = this.attendees.map((email) => ({
100
+ email,
101
+ }));
102
+ }
103
+
104
+ const response = await this.googleCalendar.updateEvent({
105
+ calendarId: this.calendarId,
106
+ eventId: this.eventId,
107
+ requestBody: {
108
+ summary: this.summary,
109
+ location: this.location,
110
+ description: this.description,
111
+ start: {
112
+ date: this.eventStartDate.length <= 10
113
+ ? this.eventStartDate
114
+ : undefined,
115
+ dateTime: this.eventStartDate.length > 10
116
+ ? this.eventStartDate
117
+ : undefined,
118
+ timeZone,
119
+ },
120
+ end: {
121
+ date: this.eventEndDate.length <= 10
122
+ ? this.eventEndDate
123
+ : undefined,
124
+ dateTime: this.eventEndDate.length > 10
125
+ ? this.eventEndDate
126
+ : undefined,
127
+ timeZone,
128
+ },
129
+ attendees,
130
+ },
131
+ });
132
+
133
+ $.export("$summary", `Successfully updated event ${response.id}`);
134
+
135
+ return response;
136
+ },
137
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/google_calendar",
3
- "version": "0.3.5",
3
+ "version": "0.3.6",
4
4
  "description": "Pipedream Google_calendar Components",
5
5
  "main": "google_calendar.app.mjs",
6
6
  "keywords": [