@pipedream/google_calendar 0.7.0 → 0.8.0

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.5",
8
+ version: "0.0.6",
9
9
  annotations: {
10
10
  destructiveHint: true,
11
11
  openWorldHint: true,
@@ -82,31 +82,48 @@ export default {
82
82
  });
83
83
  return timeZone;
84
84
  },
85
- formatAttendees(selectedAttendees, currentAttendees) {
86
- /**
87
- * Format for the attendees
88
- *
89
- * [
90
- * { "email": "lpage@example.com",},
91
- * { "email": "sbrin@example.com",},
92
- * ]
93
- */
94
- let attendees = [];
95
- if (typeof selectedAttendees === "string") {
96
- selectedAttendees = selectedAttendees.includes("[") && selectedAttendees.includes("]")
97
- ? JSON.parse(selectedAttendees)
98
- : selectedAttendees.replaceAll(" ", "").split(",");
85
+ parseEmails(input) {
86
+ if (typeof input === "string") {
87
+ return input.split(",")
88
+ .map((e) => e.trim())
89
+ .filter(Boolean);
90
+ }
91
+ if (Array.isArray(input)) {
92
+ return input
93
+ .filter((e) => typeof e === "string")
94
+ .map((e) => e.trim())
95
+ .filter(Boolean);
99
96
  }
100
- if (selectedAttendees && Array.isArray(selectedAttendees)) {
101
- attendees = selectedAttendees.map((email) => ({
97
+ return [];
98
+ },
99
+ formatAttendees(selectedAttendees, currentAttendees) {
100
+ const emails = this.parseEmails(selectedAttendees);
101
+
102
+ if (emails.length) {
103
+ return emails.map((email) => ({
102
104
  email,
103
105
  }));
104
- } else if (currentAttendees && Array.isArray(currentAttendees)) {
105
- return currentAttendees.map((attendee) => ({
106
- email: attendee.email,
106
+ }
107
+
108
+ // Fall back to currentAttendees if no selectedAttendees
109
+ const fallbackEmails = this.parseEmails(currentAttendees);
110
+ if (fallbackEmails.length) {
111
+ return fallbackEmails.map((email) => ({
112
+ email,
107
113
  }));
108
114
  }
109
- return attendees;
115
+
116
+ // Handle currentAttendees as array of attendee objects
117
+ if (Array.isArray(currentAttendees) && currentAttendees.length) {
118
+ return currentAttendees
119
+ .filter((a) => a && typeof a.email === "string")
120
+ .map((attendee) => ({
121
+ email: attendee.email.trim(),
122
+ }))
123
+ .filter((a) => a.email);
124
+ }
125
+
126
+ return [];
110
127
  },
111
128
  checkDateOrDateTimeInput(date, type) {
112
129
  if (type === "date") {
@@ -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.8",
10
+ version: "1.0.0",
11
11
  annotations: {
12
12
  destructiveHint: false,
13
13
  openWorldHint: true,
@@ -16,68 +16,68 @@ export default {
16
16
  type: "action",
17
17
  props: {
18
18
  googleCalendar,
19
- addType: {
20
- type: "string",
21
- label: "Type of Add",
22
- description: "Whether to perform a quick add or a detailed event",
23
- options: [
24
- {
25
- label: "Add Detailed Event",
26
- value: "detailed",
27
- },
28
- {
29
- label: "Add Quick Event using Natural Language",
30
- value: "quick",
31
- },
32
- ],
33
- reloadProps: true,
34
- },
35
19
  calendarId: {
36
20
  propDefinition: [
37
21
  googleCalendar,
38
22
  "calendarId",
39
23
  ],
40
24
  },
41
- text: {
42
- type: "string",
43
- label: "Describe Event",
44
- description: "Write a plain text description of event, and Google will parse this string to create the event. eg. 'Meet with Michael 10am 7/22/2024' or 'Call Sarah at 1:30PM on Friday'",
45
- hidden: true,
46
- },
47
25
  summary: {
48
26
  label: "Event Title",
49
27
  type: "string",
50
28
  description: "Enter a title for the event, (e.g., `My event`)",
29
+ },
30
+ eventStartDate: {
31
+ label: "Event Start Date",
32
+ type: "string",
33
+ description: "For all-day events, enter the date in the format `yyyy-mm-dd` (e.g., `2025-01-15`). 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` (e.g., `2025-01-15T10:00:00-05:00`). A time zone offset is required unless a time zone is explicitly specified in timeZone.",
34
+ },
35
+ eventEndDate: {
36
+ label: "Event End Date",
37
+ type: "string",
38
+ description: "For all-day events, enter the date in the format `yyyy-mm-dd` (e.g., `2025-01-15`). 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` (e.g., `2025-01-15T11:00:00-05:00`). A time zone offset is required unless a time zone is explicitly specified in timeZone.",
39
+ },
40
+ location: {
41
+ label: "Event Location",
42
+ type: "string",
43
+ description: "Specify the location of the event",
44
+ optional: true,
45
+ },
46
+ description: {
47
+ label: "Event Description",
48
+ type: "string",
49
+ description: "Enter a description for the event",
50
+ optional: true,
51
+ },
52
+ attendees: {
53
+ label: "Attendees",
54
+ type: "string[]",
55
+ description: "An array of email addresses (e.g., `[\"alice@example.com\", \"bob@example.com\"]`)",
51
56
  optional: true,
52
- hidden: true,
53
57
  },
54
58
  colorId: {
55
59
  propDefinition: [
56
60
  googleCalendar,
57
61
  "colorId",
58
62
  ],
59
- hidden: true,
60
63
  },
61
64
  timeZone: {
62
65
  propDefinition: [
63
66
  googleCalendar,
64
67
  "timeZone",
65
68
  ],
66
- hidden: true,
67
69
  },
68
70
  sendUpdates: {
69
71
  propDefinition: [
70
72
  googleCalendar,
71
73
  "sendUpdates",
72
74
  ],
73
- hidden: true,
74
75
  },
75
76
  createMeetRoom: {
76
77
  type: "boolean",
77
78
  label: "Create Meet Room",
78
79
  description: "Whether to create a Google Meet room for this event.",
79
80
  optional: true,
80
- hidden: true,
81
81
  },
82
82
  visibility: {
83
83
  type: "string",
@@ -90,49 +90,45 @@ export default {
90
90
  "confidential",
91
91
  ],
92
92
  optional: true,
93
- hidden: true,
93
+ },
94
+ repeatFrequency: {
95
+ type: "string",
96
+ label: "Repeat Frequency",
97
+ description: "Select a frequency to make this event repeating",
98
+ optional: true,
99
+ options: Object.keys(constants.REPEAT_FREQUENCIES),
100
+ reloadProps: true,
94
101
  },
95
102
  },
96
- async additionalProps(props) {
97
- const isDetailed = this.addType === "detailed";
98
-
99
- props.text.hidden = isDetailed;
100
-
101
- props.summary.hidden = !isDetailed;
102
- props.colorId.hidden = !isDetailed;
103
- props.timeZone.hidden = !isDetailed;
104
- props.sendUpdates.hidden = !isDetailed;
105
- props.createMeetRoom.hidden = !isDetailed;
106
- props.visibility.hidden = !isDetailed;
107
-
108
- if (isDetailed) {
109
- const commonProps = createEventCommon.props({
110
- isUpdate: false,
111
- });
112
- if (this.repeatFrequency) {
113
- const frequency = constants.REPEAT_FREQUENCIES[this.repeatFrequency];
114
- commonProps.repeatInterval.description = `Enter 1 to "repeat every ${frequency}", enter 2 to "repeat every other ${frequency}", etc. Defaults to 1.`;
115
- commonProps.repeatInterval.hidden = !this.repeatFrequency;
116
- commonProps.repeatUntil.hidden = !this.repeatFrequency;
117
- commonProps.repeatTimes.hidden = !this.repeatFrequency;
118
- }
119
- return commonProps;
103
+ async additionalProps() {
104
+ const props = {};
105
+ const frequency = constants.REPEAT_FREQUENCIES[this.repeatFrequency];
106
+ if (frequency) {
107
+ props.repeatInterval = {
108
+ type: "integer",
109
+ label: "Repeat Interval",
110
+ description: `Enter 1 to "repeat every ${frequency}", enter 2 to "repeat every other ${frequency}", etc. Defaults to 1.`,
111
+ optional: true,
112
+ };
113
+ props.repeatUntil = {
114
+ type: "string",
115
+ label: "Repeat Until",
116
+ description: "The event will repeat only until this date (format: `yyyy-mm-dd`, e.g., `2025-12-31`)",
117
+ optional: true,
118
+ };
119
+ props.repeatTimes = {
120
+ type: "integer",
121
+ label: "Repeat How Many Times?",
122
+ description: "Limit the number of times this event will occur",
123
+ optional: true,
124
+ };
120
125
  }
121
- return {};
126
+ return props;
122
127
  },
123
128
  methods: {
124
129
  ...createEventCommon.methods,
125
130
  },
126
131
  async run({ $ }) {
127
- if (this.addType === "quick") {
128
- const quickResponse = await this.googleCalendar.quickAddEvent({
129
- calendarId: this.calendarId,
130
- text: this.text,
131
- });
132
- $.export("$summary", `Successfully added a quick event: "${quickResponse.id}"`);
133
- return quickResponse;
134
- }
135
-
136
132
  const timeZone = await this.getTimeZone(this.timeZone);
137
133
  const attendees = this.formatAttendees(this.attendees);
138
134
  const recurrence = this.formatRecurrence({
@@ -142,6 +138,9 @@ export default {
142
138
  repeatUntil: this.repeatUntil,
143
139
  });
144
140
 
141
+ const trimmedStart = this.eventStartDate?.trim();
142
+ const trimmedEnd = this.eventEndDate?.trim();
143
+
145
144
  const data = {
146
145
  calendarId: this.calendarId,
147
146
  sendUpdates: this.sendUpdates,
@@ -150,20 +149,20 @@ export default {
150
149
  location: this.location,
151
150
  description: this.description,
152
151
  start: {
153
- date: this.eventStartDate?.length <= 10
154
- ? this.eventStartDate
152
+ date: trimmedStart?.length <= 10
153
+ ? trimmedStart
155
154
  : undefined,
156
- dateTime: this.eventStartDate?.length > 10
157
- ? this.eventStartDate
155
+ dateTime: trimmedStart?.length > 10
156
+ ? trimmedStart
158
157
  : undefined,
159
158
  timeZone,
160
159
  },
161
160
  end: {
162
- date: this.eventEndDate?.length <= 10
163
- ? this.eventEndDate
161
+ date: trimmedEnd?.length <= 10
162
+ ? trimmedEnd
164
163
  : undefined,
165
- dateTime: this.eventEndDate?.length > 10
166
- ? this.eventEndDate
164
+ dateTime: trimmedEnd?.length > 10
165
+ ? trimmedEnd
167
166
  : undefined,
168
167
  timeZone,
169
168
  },
@@ -0,0 +1,59 @@
1
+ import googleCalendar from "../../google_calendar.app.mjs";
2
+
3
+ export default {
4
+ key: "google_calendar-get-date-time",
5
+ name: "Get Date Time",
6
+ description: "Get current date and time for use in Google Calendar actions. Useful for agents that need datetime awareness and timezone context before calling other Google Calendar tools.",
7
+ version: "0.0.1",
8
+ type: "action",
9
+ annotations: {
10
+ destructiveHint: false,
11
+ openWorldHint: true,
12
+ readOnlyHint: true,
13
+ },
14
+ props: {
15
+ googleCalendar,
16
+ },
17
+ async run({ $ }) {
18
+ const now = new Date();
19
+
20
+ // Date in local timezone (YYYY-MM-DD)
21
+ const year = now.getFullYear();
22
+ const month = String(now.getMonth() + 1).padStart(2, "0");
23
+ const day = String(now.getDate()).padStart(2, "0");
24
+ const date = `${year}-${month}-${day}`;
25
+
26
+ // Time in local timezone (HH:MM:SS)
27
+ const time = now.toTimeString().split(" ")[0];
28
+
29
+ // Timezone (IANA name)
30
+ // eslint-disable-next-line no-undef
31
+ const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
32
+
33
+ // Timezone offset (±HH:MM)
34
+ const tzDate = new Date();
35
+ const tzDateUTC = new Date(tzDate.toLocaleString("en-US", {
36
+ timeZone: "UTC",
37
+ }));
38
+ const diff = (tzDate - tzDateUTC) / 60000;
39
+ const hours = Math.floor(Math.abs(diff) / 60);
40
+ const mins = Math.abs(diff) % 60;
41
+ const offsetSign = diff >= 0
42
+ ? "+"
43
+ : "-";
44
+ const timezoneOffset = `${offsetSign}${String(hours).padStart(2, "0")}:${String(mins).padStart(2, "0")}`;
45
+
46
+ const result = {
47
+ date,
48
+ time,
49
+ timezone,
50
+ timezoneOffset,
51
+ timestamp: now.getTime(),
52
+ isoString: now.toISOString(),
53
+ rfc3339: `${date}T${time}${timezoneOffset}`,
54
+ };
55
+
56
+ $.export("$summary", `Retrieved current date time: ${date} ${time} (${timezone || ""} ${timezoneOffset})`);
57
+ return result;
58
+ },
59
+ };
@@ -6,7 +6,7 @@ export default {
6
6
  key: "google_calendar-quick-add-event",
7
7
  name: "Add Quick Event",
8
8
  description: "Create a quick event to the Google Calendar. [See the documentation](https://googleapis.dev/nodejs/googleapis/latest/calendar/classes/Resource$Events.html#quickAdd)",
9
- version: "0.1.10",
9
+ version: "0.1.11",
10
10
  annotations: {
11
11
  destructiveHint: false,
12
12
  openWorldHint: true,
@@ -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.12",
9
+ version: "0.0.13",
10
10
  annotations: {
11
11
  destructiveHint: true,
12
12
  openWorldHint: true,
@@ -5,7 +5,7 @@ export default {
5
5
  key: "google_calendar-update-event-instance",
6
6
  name: "Update Event Instance",
7
7
  description: "Update a specific instance of a recurring event. Changes apply only to the selected instance. [See the documentation](https://developers.google.com/calendar/api/v3/reference/events/update)",
8
- version: "0.0.1",
8
+ version: "0.0.2",
9
9
  type: "action",
10
10
  annotations: {
11
11
  destructiveHint: true,
@@ -6,7 +6,7 @@ export default {
6
6
  key: "google_calendar-update-following-instances",
7
7
  name: "Update Following Event Instances",
8
8
  description: "Update all instances of a recurring event following a specific instance. This creates a new recurring event starting from the selected instance. [See the documentation](https://developers.google.com/calendar/api/guides/recurringevents#modifying_all_following_instances)",
9
- version: "0.0.1",
9
+ version: "0.0.2",
10
10
  type: "action",
11
11
  annotations: {
12
12
  destructiveHint: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/google_calendar",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "Pipedream Google_calendar Components",
5
5
  "main": "google_calendar.app.mjs",
6
6
  "keywords": [