@scopieflows/app-google-calendar 0.8.1

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 (75) hide show
  1. package/README.md +7 -0
  2. package/package.json +30 -0
  3. package/src/i18n/ca.json +71 -0
  4. package/src/i18n/de.json +151 -0
  5. package/src/i18n/es.json +151 -0
  6. package/src/i18n/fr.json +151 -0
  7. package/src/i18n/hi.json +71 -0
  8. package/src/i18n/id.json +71 -0
  9. package/src/i18n/ja.json +151 -0
  10. package/src/i18n/nl.json +151 -0
  11. package/src/i18n/pt.json +151 -0
  12. package/src/i18n/ru.json +71 -0
  13. package/src/i18n/translation.json +151 -0
  14. package/src/i18n/vi.json +71 -0
  15. package/src/i18n/zh.json +151 -0
  16. package/src/index.d.ts +2 -0
  17. package/src/index.js +90 -0
  18. package/src/index.js.map +1 -0
  19. package/src/lib/actions/add-attendees.action.d.ts +5 -0
  20. package/src/lib/actions/add-attendees.action.js +54 -0
  21. package/src/lib/actions/add-attendees.action.js.map +1 -0
  22. package/src/lib/actions/add-calendar-to-calendarlist.d.ts +3 -0
  23. package/src/lib/actions/add-calendar-to-calendarlist.js +36 -0
  24. package/src/lib/actions/add-calendar-to-calendarlist.js.map +1 -0
  25. package/src/lib/actions/create-event.d.ts +15 -0
  26. package/src/lib/actions/create-event.js +149 -0
  27. package/src/lib/actions/create-event.js.map +1 -0
  28. package/src/lib/actions/create-quick-event.d.ts +5 -0
  29. package/src/lib/actions/create-quick-event.js +67 -0
  30. package/src/lib/actions/create-quick-event.js.map +1 -0
  31. package/src/lib/actions/delete-event.action.d.ts +4 -0
  32. package/src/lib/actions/delete-event.action.js +37 -0
  33. package/src/lib/actions/delete-event.action.js.map +1 -0
  34. package/src/lib/actions/find-busy-free-periods.d.ts +5 -0
  35. package/src/lib/actions/find-busy-free-periods.js +78 -0
  36. package/src/lib/actions/find-busy-free-periods.js.map +1 -0
  37. package/src/lib/actions/get-event-by-id.d.ts +6 -0
  38. package/src/lib/actions/get-event-by-id.js +93 -0
  39. package/src/lib/actions/get-event-by-id.js.map +1 -0
  40. package/src/lib/actions/get-events.d.ts +8 -0
  41. package/src/lib/actions/get-events.js +99 -0
  42. package/src/lib/actions/get-events.js.map +1 -0
  43. package/src/lib/actions/update-event.action.d.ts +14 -0
  44. package/src/lib/actions/update-event.action.js +114 -0
  45. package/src/lib/actions/update-event.action.js.map +1 -0
  46. package/src/lib/common/helper.d.ts +12 -0
  47. package/src/lib/common/helper.js +191 -0
  48. package/src/lib/common/helper.js.map +1 -0
  49. package/src/lib/common/index.d.ts +6 -0
  50. package/src/lib/common/index.js +94 -0
  51. package/src/lib/common/index.js.map +1 -0
  52. package/src/lib/common/types.d.ts +239 -0
  53. package/src/lib/common/types.js +17 -0
  54. package/src/lib/common/types.js.map +1 -0
  55. package/src/lib/triggers/calendar-event.d.ts +14 -0
  56. package/src/lib/triggers/calendar-event.js +144 -0
  57. package/src/lib/triggers/calendar-event.js.map +1 -0
  58. package/src/lib/triggers/event-cancelled.d.ts +22 -0
  59. package/src/lib/triggers/event-cancelled.js +165 -0
  60. package/src/lib/triggers/event-cancelled.js.map +1 -0
  61. package/src/lib/triggers/event-ends.d.ts +18 -0
  62. package/src/lib/triggers/event-ends.js +167 -0
  63. package/src/lib/triggers/event-ends.js.map +1 -0
  64. package/src/lib/triggers/event-start-time-before.d.ts +26 -0
  65. package/src/lib/triggers/event-start-time-before.js +161 -0
  66. package/src/lib/triggers/event-start-time-before.js.map +1 -0
  67. package/src/lib/triggers/new-calendar.d.ts +18 -0
  68. package/src/lib/triggers/new-calendar.js +151 -0
  69. package/src/lib/triggers/new-calendar.js.map +1 -0
  70. package/src/lib/triggers/new-event-matching-search.d.ts +22 -0
  71. package/src/lib/triggers/new-event-matching-search.js +185 -0
  72. package/src/lib/triggers/new-event-matching-search.js.map +1 -0
  73. package/src/lib/triggers/new-event.d.ts +22 -0
  74. package/src/lib/triggers/new-event.js +161 -0
  75. package/src/lib/triggers/new-event.js.map +1 -0
@@ -0,0 +1,185 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.newEventMatchingSearch = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@scopieflows/pieces-framework");
6
+ const pieces_framework_2 = require("@scopieflows/pieces-framework");
7
+ const common_1 = require("../common");
8
+ const __1 = require("../../");
9
+ const pieces_common_1 = require("@scopieflows/pieces-common");
10
+ const pieces_common_2 = require("@scopieflows/pieces-common");
11
+ const polling = {
12
+ strategy: pieces_common_1.DedupeStrategy.TIMEBASED,
13
+ items: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth, propsValue, lastFetchEpochMS }) {
14
+ const { calendar_id, search_term, event_types, search_fields } = propsValue;
15
+ if (!calendar_id || !search_term) {
16
+ return [];
17
+ }
18
+ let minUpdated;
19
+ if (lastFetchEpochMS === 0) {
20
+ minUpdated = new Date();
21
+ minUpdated.setDate(minUpdated.getDate() - 1);
22
+ }
23
+ else {
24
+ minUpdated = new Date(lastFetchEpochMS);
25
+ }
26
+ const queryParams = {
27
+ singleEvents: 'true',
28
+ orderBy: 'updated',
29
+ updatedMin: minUpdated.toISOString(),
30
+ q: search_term,
31
+ };
32
+ if (event_types && event_types.length > 0) {
33
+ event_types.forEach((type) => {
34
+ if (!queryParams.eventTypes) {
35
+ queryParams.eventTypes = type;
36
+ }
37
+ else {
38
+ queryParams.eventTypes += '&eventTypes=' + type;
39
+ }
40
+ });
41
+ }
42
+ const request = {
43
+ method: pieces_common_2.HttpMethod.GET,
44
+ url: `${common_1.googleCalendarCommon.baseUrl}/calendars/${calendar_id}/events`,
45
+ authentication: {
46
+ type: pieces_common_2.AuthenticationType.BEARER_TOKEN,
47
+ token: auth.access_token,
48
+ },
49
+ queryParams: queryParams,
50
+ };
51
+ const response = yield pieces_common_2.httpClient.sendRequest(request);
52
+ const events = response.body.items;
53
+ const newEvents = events.filter((event) => {
54
+ var _a, _b;
55
+ const created = new Date((_a = event.created) !== null && _a !== void 0 ? _a : 0).getTime();
56
+ const updated = new Date((_b = event.updated) !== null && _b !== void 0 ? _b : 0).getTime();
57
+ const isNewEvent = updated - created < 5000;
58
+ if (!isNewEvent)
59
+ return false;
60
+ if (search_fields && search_fields.length > 0) {
61
+ const searchTermLower = search_term.toLowerCase();
62
+ return search_fields.some((field) => {
63
+ var _a, _b, _c, _d;
64
+ switch (field) {
65
+ case 'summary':
66
+ return (((_a = event.summary) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(searchTermLower)) || false);
67
+ case 'description':
68
+ return (((_b = event.description) === null || _b === void 0 ? void 0 : _b.toLowerCase().includes(searchTermLower)) ||
69
+ false);
70
+ case 'location':
71
+ return (((_c = event.location) === null || _c === void 0 ? void 0 : _c.toLowerCase().includes(searchTermLower)) || false);
72
+ case 'attendees':
73
+ return (((_d = event.attendees) === null || _d === void 0 ? void 0 : _d.some((attendee) => {
74
+ var _a, _b;
75
+ return ((_a = attendee.email) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(searchTermLower)) ||
76
+ ((_b = attendee.displayName) === null || _b === void 0 ? void 0 : _b.toLowerCase().includes(searchTermLower));
77
+ })) || false);
78
+ default:
79
+ return false;
80
+ }
81
+ });
82
+ }
83
+ return true;
84
+ });
85
+ return newEvents.map((event) => {
86
+ return {
87
+ epochMilliSeconds: new Date(event.updated).getTime(),
88
+ data: event,
89
+ };
90
+ });
91
+ }),
92
+ };
93
+ exports.newEventMatchingSearch = (0, pieces_framework_1.createTrigger)({
94
+ auth: __1.googleCalendarAuth,
95
+ name: 'new_event_matching_search',
96
+ displayName: 'New Event Matching Search',
97
+ description: 'Fires when a new event is created that matches a specified search term.',
98
+ props: {
99
+ calendar_id: common_1.googleCalendarCommon.calendarDropdown('writer'),
100
+ search_term: pieces_framework_1.Property.ShortText({
101
+ displayName: 'Search Term',
102
+ description: 'The keyword(s) to search for in new events (searches across title, description, location, and attendees by default).',
103
+ required: true,
104
+ }),
105
+ event_types: pieces_framework_1.Property.StaticMultiSelectDropdown({
106
+ displayName: 'Event Types',
107
+ description: 'Filter by specific event types (optional)',
108
+ required: false,
109
+ options: {
110
+ options: [
111
+ { label: 'Default Events', value: 'default' },
112
+ { label: 'Birthday Events', value: 'birthday' },
113
+ { label: 'Focus Time', value: 'focusTime' },
114
+ { label: 'Out of Office', value: 'outOfOffice' },
115
+ { label: 'Working Location', value: 'workingLocation' },
116
+ { label: 'From Gmail', value: 'fromGmail' },
117
+ ],
118
+ },
119
+ }),
120
+ search_fields: pieces_framework_1.Property.StaticMultiSelectDropdown({
121
+ displayName: 'Search In Fields',
122
+ description: "Specify which fields to search in (leave empty to use Google's default search across all fields)",
123
+ required: false,
124
+ options: {
125
+ options: [
126
+ { label: 'Event Title/Summary', value: 'summary' },
127
+ { label: 'Event Description', value: 'description' },
128
+ { label: 'Event Location', value: 'location' },
129
+ { label: 'Attendee Names/Emails', value: 'attendees' },
130
+ ],
131
+ },
132
+ }),
133
+ },
134
+ type: pieces_framework_2.TriggerStrategy.POLLING,
135
+ sampleData: {
136
+ id: 'abc123def456',
137
+ summary: 'Final Project Review',
138
+ description: 'Review of the Q3 final project deliverables.',
139
+ status: 'confirmed',
140
+ created: '2025-08-14T09:05:00.000Z',
141
+ updated: '2025-08-14T09:05:01.000Z',
142
+ start: { dateTime: '2025-09-01T10:00:00-07:00' },
143
+ end: { dateTime: '2025-09-01T11:30:00-07:00' },
144
+ organizer: { email: 'project.manager@example.com' },
145
+ },
146
+ onEnable(context) {
147
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
148
+ yield pieces_common_1.pollingHelper.onEnable(polling, {
149
+ auth: context.auth,
150
+ store: context.store,
151
+ propsValue: context.propsValue,
152
+ });
153
+ });
154
+ },
155
+ onDisable(context) {
156
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
157
+ yield pieces_common_1.pollingHelper.onDisable(polling, {
158
+ auth: context.auth,
159
+ store: context.store,
160
+ propsValue: context.propsValue,
161
+ });
162
+ });
163
+ },
164
+ run(context) {
165
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
166
+ return yield pieces_common_1.pollingHelper.poll(polling, {
167
+ auth: context.auth,
168
+ store: context.store,
169
+ propsValue: context.propsValue,
170
+ files: context.files,
171
+ });
172
+ });
173
+ },
174
+ test(context) {
175
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
176
+ return yield pieces_common_1.pollingHelper.test(polling, {
177
+ auth: context.auth,
178
+ store: context.store,
179
+ propsValue: context.propsValue,
180
+ files: context.files,
181
+ });
182
+ });
183
+ },
184
+ });
185
+ //# sourceMappingURL=new-event-matching-search.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"new-event-matching-search.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/google-calendar/src/lib/triggers/new-event-matching-search.ts"],"names":[],"mappings":";;;;AAAA,oEAIuC;AACvC,oEAAgE;AAChE,sCAAiD;AAEjD,8BAA4C;AAC5C,8DAIoC;AACpC,8DAKoC;AAMpC,MAAM,OAAO,GAQT;IACF,QAAQ,EAAE,8BAAc,CAAC,SAAS;IAClC,KAAK,EAAE,KAA+C,EAAE,oDAA1C,EAAE,IAAI,EAAE,UAAU,EAAE,gBAAgB,EAAE;QAClD,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,aAAa,EAAE,GAAG,UAAU,CAAC;QAE5E,IAAI,CAAC,WAAW,IAAI,CAAC,WAAW,EAAE,CAAC;YACjC,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,IAAI,UAAgB,CAAC;QACrB,IAAI,gBAAgB,KAAK,CAAC,EAAE,CAAC;YAC3B,UAAU,GAAG,IAAI,IAAI,EAAE,CAAC;YACxB,UAAU,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC;QAC/C,CAAC;aAAM,CAAC;YACN,UAAU,GAAG,IAAI,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAC1C,CAAC;QAED,MAAM,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OAAO,CAAC,KAAK;gBACpB,UAAU,EAAE,OAAO,CAAC,UAAU;gBAC9B,KAAK,EAAE,OAAO,CAAC,KAAK;aACrB,CAAC,CAAC;QACL,CAAC;KAAA;IAEK,IAAI,CAAC,OAAO;;YAChB,OAAO,MAAM,6BAAa,CAAC,IAAI,CAAC,OAAO,EAAE;gBACvC,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,KAAK,EAAE,OAAO,CAAC,KAAK;gBACpB,UAAU,EAAE,OAAO,CAAC,UAAU;gBAC9B,KAAK,EAAE,OAAO,CAAC,KAAK;aACrB,CAAC,CAAC;QACL,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { TriggerStrategy } from '@scopieflows/pieces-framework';
2
+ export declare const newEvent: import("@scopieflows/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>, {
3
+ calendar_id: import("@scopieflows/pieces-framework").DropdownProperty<string, true, import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>>;
4
+ event_types: import("@scopieflows/pieces-framework").StaticMultiSelectDropdownProperty<string, false>;
5
+ search_filter: import("@scopieflows/pieces-framework").ShortTextProperty<false>;
6
+ exclude_all_day: import("@scopieflows/pieces-framework").CheckboxProperty<false>;
7
+ }> | import("@scopieflows/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>, {
8
+ calendar_id: import("@scopieflows/pieces-framework").DropdownProperty<string, true, import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>>;
9
+ event_types: import("@scopieflows/pieces-framework").StaticMultiSelectDropdownProperty<string, false>;
10
+ search_filter: import("@scopieflows/pieces-framework").ShortTextProperty<false>;
11
+ exclude_all_day: import("@scopieflows/pieces-framework").CheckboxProperty<false>;
12
+ }> | import("@scopieflows/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>, {
13
+ calendar_id: import("@scopieflows/pieces-framework").DropdownProperty<string, true, import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>>;
14
+ event_types: import("@scopieflows/pieces-framework").StaticMultiSelectDropdownProperty<string, false>;
15
+ search_filter: import("@scopieflows/pieces-framework").ShortTextProperty<false>;
16
+ exclude_all_day: import("@scopieflows/pieces-framework").CheckboxProperty<false>;
17
+ }> | import("@scopieflows/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>, {
18
+ calendar_id: import("@scopieflows/pieces-framework").DropdownProperty<string, true, import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>>;
19
+ event_types: import("@scopieflows/pieces-framework").StaticMultiSelectDropdownProperty<string, false>;
20
+ search_filter: import("@scopieflows/pieces-framework").ShortTextProperty<false>;
21
+ exclude_all_day: import("@scopieflows/pieces-framework").CheckboxProperty<false>;
22
+ }>;
@@ -0,0 +1,161 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.newEvent = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@scopieflows/pieces-framework");
6
+ const __1 = require("../../");
7
+ const common_1 = require("../common");
8
+ const helper_1 = require("../common/helper");
9
+ exports.newEvent = (0, pieces_framework_1.createTrigger)({
10
+ auth: __1.googleCalendarAuth,
11
+ name: 'new_event',
12
+ displayName: 'New Event',
13
+ description: 'Fires when a new event is created in a calendar.',
14
+ props: {
15
+ calendar_id: common_1.googleCalendarCommon.calendarDropdown('writer'),
16
+ event_types: pieces_framework_1.Property.StaticMultiSelectDropdown({
17
+ displayName: 'Event Types to Monitor',
18
+ description: 'Filter by specific event types (leave empty to monitor all event types)',
19
+ required: false,
20
+ options: {
21
+ options: [
22
+ { label: 'Default Events', value: 'default' },
23
+ { label: 'Birthday Events', value: 'birthday' },
24
+ { label: 'Focus Time', value: 'focusTime' },
25
+ { label: 'Out of Office', value: 'outOfOffice' },
26
+ { label: 'Working Location', value: 'workingLocation' },
27
+ { label: 'From Gmail', value: 'fromGmail' },
28
+ ],
29
+ },
30
+ }),
31
+ search_filter: pieces_framework_1.Property.ShortText({
32
+ displayName: 'Search Filter',
33
+ description: 'Only trigger for events containing this text in title, description, or location (optional)',
34
+ required: false,
35
+ }),
36
+ exclude_all_day: pieces_framework_1.Property.Checkbox({
37
+ displayName: 'Exclude All-Day Events',
38
+ description: 'Skip triggering for all-day events',
39
+ required: false,
40
+ defaultValue: false,
41
+ }),
42
+ },
43
+ type: pieces_framework_1.TriggerStrategy.WEBHOOK,
44
+ sampleData: {
45
+ kind: 'calendar#event',
46
+ etag: '"3419997894982000"',
47
+ id: 'sample_event_id_12345',
48
+ status: 'confirmed',
49
+ htmlLink: 'https://www.google.com/calendar/event?eid=c2FtcGxlX2V2ZW50X2lkXzEyMzQ1',
50
+ created: '2025-08-15T11:02:27.000Z',
51
+ updated: '2025-08-15T11:02:27.491Z',
52
+ summary: 'Team Sync',
53
+ creator: { email: 'creator@example.com' },
54
+ organizer: {
55
+ email: 'creator@example.com',
56
+ self: true,
57
+ },
58
+ start: {
59
+ dateTime: '2025-08-18T10:00:00-07:00',
60
+ timeZone: 'America/Los_Angeles',
61
+ },
62
+ end: {
63
+ dateTime: '2025-08-18T11:00:00-07:00',
64
+ timeZone: 'America/Los_Angeles',
65
+ },
66
+ iCalUID: 'sample_event_id_12345@google.com',
67
+ sequence: 0,
68
+ reminders: { useDefault: true },
69
+ eventType: 'default',
70
+ },
71
+ onEnable(context) {
72
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
73
+ const calendarId = context.propsValue.calendar_id;
74
+ const auth = context.auth;
75
+ const response = yield (0, helper_1.watchEvent)(calendarId, context.webhookUrl, auth);
76
+ yield context.store.put('google_calendar_watch', response);
77
+ });
78
+ },
79
+ onDisable(context) {
80
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
81
+ const auth = context.auth;
82
+ const watch = yield context.store.get('google_calendar_watch');
83
+ if (watch) {
84
+ yield (0, helper_1.stopWatchEvent)(watch, auth);
85
+ }
86
+ });
87
+ },
88
+ run(context) {
89
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
90
+ var _a, _b;
91
+ const payload = context.payload;
92
+ const headers = payload.headers;
93
+ const { event_types, search_filter, exclude_all_day } = context.propsValue;
94
+ if (headers['x-goog-resource-state'] === 'add') {
95
+ const eventData = payload.body;
96
+ if (event_types && event_types.length > 0) {
97
+ const eventType = eventData.eventType || 'default';
98
+ if (!event_types.includes(eventType)) {
99
+ return [];
100
+ }
101
+ }
102
+ if (search_filter && search_filter.trim()) {
103
+ const searchTerm = search_filter.toLowerCase().trim();
104
+ const summary = (eventData.summary || '').toLowerCase();
105
+ const description = (eventData.description || '').toLowerCase();
106
+ const location = (eventData.location || '').toLowerCase();
107
+ const matchesSearch = summary.includes(searchTerm) ||
108
+ description.includes(searchTerm) ||
109
+ location.includes(searchTerm);
110
+ if (!matchesSearch) {
111
+ return [];
112
+ }
113
+ }
114
+ if (exclude_all_day) {
115
+ const isAllDay = ((_a = eventData.start) === null || _a === void 0 ? void 0 : _a.date) && !((_b = eventData.start) === null || _b === void 0 ? void 0 : _b.dateTime);
116
+ if (isAllDay) {
117
+ return [];
118
+ }
119
+ }
120
+ return [eventData];
121
+ }
122
+ else {
123
+ return [];
124
+ }
125
+ });
126
+ },
127
+ test(context) {
128
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
129
+ var _a, _b;
130
+ const auth = context.auth;
131
+ const { event_types, search_filter, exclude_all_day } = context.propsValue;
132
+ const latestEvent = yield (0, helper_1.getLatestEvent)(context.propsValue.calendar_id, auth);
133
+ if (event_types && event_types.length > 0) {
134
+ const eventType = latestEvent.eventType || 'default';
135
+ if (!event_types.includes(eventType)) {
136
+ return [];
137
+ }
138
+ }
139
+ if (search_filter && search_filter.trim()) {
140
+ const searchTerm = search_filter.toLowerCase().trim();
141
+ const summary = (latestEvent.summary || '').toLowerCase();
142
+ const description = (latestEvent.description || '').toLowerCase();
143
+ const location = (latestEvent.location || '').toLowerCase();
144
+ const matchesSearch = summary.includes(searchTerm) ||
145
+ description.includes(searchTerm) ||
146
+ location.includes(searchTerm);
147
+ if (!matchesSearch) {
148
+ return [];
149
+ }
150
+ }
151
+ if (exclude_all_day) {
152
+ const isAllDay = ((_a = latestEvent.start) === null || _a === void 0 ? void 0 : _a.date) && !((_b = latestEvent.start) === null || _b === void 0 ? void 0 : _b.dateTime);
153
+ if (isAllDay) {
154
+ return [];
155
+ }
156
+ }
157
+ return [latestEvent];
158
+ });
159
+ },
160
+ });
161
+ //# sourceMappingURL=new-event.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"new-event.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/google-calendar/src/lib/triggers/new-event.ts"],"names":[],"mappings":";;;;AAAA,oEAKuC;AACvC,8BAA4C;AAC5C,sCAAiD;AACjD,6CAA8E;AAGjE,QAAA,QAAQ,GAAG,IAAA,gCAAa,EAAC;IACpC,IAAI,EAAE,sBAAkB;IACxB,IAAI,EAAE,WAAW;IACjB,WAAW,EAAE,WAAW;IACxB,WAAW,EAAE,kDAAkD;IAC/D,KAAK,EAAE;QACL,WAAW,EAAE,6BAAoB,CAAC,gBAAgB,CAAC,QAAQ,CAAC;QAC5D,WAAW,EAAE,2BAAQ,CAAC,yBAAyB,CAAC;YAC9C,WAAW,EAAE,wBAAwB;YACrC,WAAW,EACT,yEAAyE;YAC3E,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE;gBACP,OAAO,EAAE;oBACP,EAAE,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,SAAS,EAAE;oBAC7C,EAAE,KAAK,EAAE,iBAAiB,EA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