@activepieces/piece-google-calendar 0.9.2 → 0.9.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 (85) hide show
  1. package/package.json +7 -15
  2. package/src/index.js +106 -81
  3. package/src/index.d.ts +0 -6
  4. package/src/index.d.ts.map +0 -1
  5. package/src/index.js.map +0 -1
  6. package/src/lib/actions/add-attendees.action.d.ts +0 -12
  7. package/src/lib/actions/add-attendees.action.d.ts.map +0 -1
  8. package/src/lib/actions/add-attendees.action.js +0 -51
  9. package/src/lib/actions/add-attendees.action.js.map +0 -1
  10. package/src/lib/actions/add-calendar-to-calendarlist.d.ts +0 -7
  11. package/src/lib/actions/add-calendar-to-calendarlist.d.ts.map +0 -1
  12. package/src/lib/actions/add-calendar-to-calendarlist.js +0 -34
  13. package/src/lib/actions/add-calendar-to-calendarlist.js.map +0 -1
  14. package/src/lib/actions/create-event.d.ts +0 -25
  15. package/src/lib/actions/create-event.d.ts.map +0 -1
  16. package/src/lib/actions/create-event.js +0 -146
  17. package/src/lib/actions/create-event.js.map +0 -1
  18. package/src/lib/actions/create-quick-event.d.ts +0 -12
  19. package/src/lib/actions/create-quick-event.d.ts.map +0 -1
  20. package/src/lib/actions/create-quick-event.js +0 -66
  21. package/src/lib/actions/create-quick-event.js.map +0 -1
  22. package/src/lib/actions/delete-event.action.d.ts +0 -11
  23. package/src/lib/actions/delete-event.action.d.ts.map +0 -1
  24. package/src/lib/actions/delete-event.action.js +0 -34
  25. package/src/lib/actions/delete-event.action.js.map +0 -1
  26. package/src/lib/actions/find-busy-free-periods.d.ts +0 -12
  27. package/src/lib/actions/find-busy-free-periods.d.ts.map +0 -1
  28. package/src/lib/actions/find-busy-free-periods.js +0 -77
  29. package/src/lib/actions/find-busy-free-periods.js.map +0 -1
  30. package/src/lib/actions/get-event-by-id.d.ts +0 -13
  31. package/src/lib/actions/get-event-by-id.d.ts.map +0 -1
  32. package/src/lib/actions/get-event-by-id.js +0 -92
  33. package/src/lib/actions/get-event-by-id.js.map +0 -1
  34. package/src/lib/actions/get-events.d.ts +0 -15
  35. package/src/lib/actions/get-events.d.ts.map +0 -1
  36. package/src/lib/actions/get-events.js +0 -98
  37. package/src/lib/actions/get-events.js.map +0 -1
  38. package/src/lib/actions/update-event.action.d.ts +0 -24
  39. package/src/lib/actions/update-event.action.d.ts.map +0 -1
  40. package/src/lib/actions/update-event.action.js +0 -111
  41. package/src/lib/actions/update-event.action.js.map +0 -1
  42. package/src/lib/auth.d.ts +0 -11
  43. package/src/lib/auth.d.ts.map +0 -1
  44. package/src/lib/auth.js +0 -86
  45. package/src/lib/auth.js.map +0 -1
  46. package/src/lib/common/helper.d.ts +0 -26
  47. package/src/lib/common/helper.d.ts.map +0 -1
  48. package/src/lib/common/helper.js +0 -269
  49. package/src/lib/common/helper.js.map +0 -1
  50. package/src/lib/common/index.d.ts +0 -20
  51. package/src/lib/common/index.d.ts.map +0 -1
  52. package/src/lib/common/index.js +0 -99
  53. package/src/lib/common/index.js.map +0 -1
  54. package/src/lib/common/types.d.ts +0 -240
  55. package/src/lib/common/types.d.ts.map +0 -1
  56. package/src/lib/common/types.js +0 -17
  57. package/src/lib/common/types.js.map +0 -1
  58. package/src/lib/triggers/calendar-event.d.ts +0 -39
  59. package/src/lib/triggers/calendar-event.d.ts.map +0 -1
  60. package/src/lib/triggers/calendar-event.js +0 -144
  61. package/src/lib/triggers/calendar-event.js.map +0 -1
  62. package/src/lib/triggers/event-cancelled.d.ts +0 -71
  63. package/src/lib/triggers/event-cancelled.d.ts.map +0 -1
  64. package/src/lib/triggers/event-cancelled.js +0 -165
  65. package/src/lib/triggers/event-cancelled.js.map +0 -1
  66. package/src/lib/triggers/event-ends.d.ts +0 -67
  67. package/src/lib/triggers/event-ends.d.ts.map +0 -1
  68. package/src/lib/triggers/event-ends.js +0 -166
  69. package/src/lib/triggers/event-ends.js.map +0 -1
  70. package/src/lib/triggers/event-start-time-before.d.ts +0 -75
  71. package/src/lib/triggers/event-start-time-before.d.ts.map +0 -1
  72. package/src/lib/triggers/event-start-time-before.js +0 -160
  73. package/src/lib/triggers/event-start-time-before.js.map +0 -1
  74. package/src/lib/triggers/new-calendar.d.ts +0 -31
  75. package/src/lib/triggers/new-calendar.d.ts.map +0 -1
  76. package/src/lib/triggers/new-calendar.js +0 -151
  77. package/src/lib/triggers/new-calendar.js.map +0 -1
  78. package/src/lib/triggers/new-event-matching-search.d.ts +0 -47
  79. package/src/lib/triggers/new-event-matching-search.d.ts.map +0 -1
  80. package/src/lib/triggers/new-event-matching-search.js +0 -184
  81. package/src/lib/triggers/new-event-matching-search.js.map +0 -1
  82. package/src/lib/triggers/new-event.d.ts +0 -47
  83. package/src/lib/triggers/new-event.d.ts.map +0 -1
  84. package/src/lib/triggers/new-event.js +0 -225
  85. package/src/lib/triggers/new-event.js.map +0 -1
@@ -1,166 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.eventEnds = void 0;
4
- const tslib_1 = require("tslib");
5
- const pieces_framework_1 = require("@activepieces/pieces-framework");
6
- const pieces_framework_2 = require("@activepieces/pieces-framework");
7
- const common_1 = require("../common");
8
- const pieces_common_1 = require("@activepieces/pieces-common");
9
- const pieces_common_2 = require("@activepieces/pieces-common");
10
- const polling = {
11
- strategy: pieces_common_1.DedupeStrategy.TIMEBASED,
12
- items: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth, propsValue, lastFetchEpochMS }) {
13
- var _b, _c, _d, _e, _f, _g;
14
- if (lastFetchEpochMS === 0) {
15
- return [];
16
- }
17
- const { calendar_id: calendarId, specific_event, event_id } = propsValue;
18
- if (!calendarId) {
19
- return [];
20
- }
21
- if (specific_event && !event_id) {
22
- return [];
23
- }
24
- let events = [];
25
- if (specific_event && event_id) {
26
- const eventRequest = {
27
- method: pieces_common_2.HttpMethod.GET,
28
- url: `${common_1.googleCalendarCommon.baseUrl}/calendars/${calendarId}/events/${event_id}`,
29
- authentication: {
30
- type: pieces_common_2.AuthenticationType.BEARER_TOKEN,
31
- token: yield (0, common_1.getAccessToken)(auth),
32
- },
33
- };
34
- try {
35
- const eventResponse = yield pieces_common_2.httpClient.sendRequest(eventRequest);
36
- const event = eventResponse.body;
37
- const endTimeString = (_c = (_b = event.end) === null || _b === void 0 ? void 0 : _b.dateTime) !== null && _c !== void 0 ? _c : (_d = event.end) === null || _d === void 0 ? void 0 : _d.date;
38
- if (endTimeString) {
39
- const endTime = new Date(endTimeString).getTime();
40
- if (endTime > lastFetchEpochMS) {
41
- events = [event];
42
- }
43
- }
44
- }
45
- catch (error) {
46
- console.error('Error fetching specific event:', error);
47
- return [];
48
- }
49
- }
50
- else {
51
- const request = {
52
- method: pieces_common_2.HttpMethod.GET,
53
- url: `${common_1.googleCalendarCommon.baseUrl}/calendars/${calendarId}/events`,
54
- authentication: {
55
- type: pieces_common_2.AuthenticationType.BEARER_TOKEN,
56
- token: yield (0, common_1.getAccessToken)(auth),
57
- },
58
- queryParams: {
59
- singleEvents: 'true',
60
- orderBy: 'startTime',
61
- timeMin: new Date(lastFetchEpochMS).toISOString(),
62
- },
63
- };
64
- const response = yield pieces_common_2.httpClient.sendRequest(request);
65
- events = response.body.items;
66
- }
67
- const endedEvents = [];
68
- const now = Date.now();
69
- for (const event of events) {
70
- const endTimeString = (_f = (_e = event.end) === null || _e === void 0 ? void 0 : _e.dateTime) !== null && _f !== void 0 ? _f : (_g = event.end) === null || _g === void 0 ? void 0 : _g.date;
71
- if (!endTimeString)
72
- continue;
73
- const endTime = new Date(endTimeString).getTime();
74
- if (endTime > lastFetchEpochMS && endTime <= now) {
75
- endedEvents.push({
76
- epochMilliSeconds: endTime,
77
- data: event,
78
- });
79
- }
80
- }
81
- return endedEvents;
82
- }),
83
- };
84
- exports.eventEnds = (0, pieces_framework_1.createTrigger)({
85
- auth: common_1.googleCalendarAuth,
86
- name: 'event_ends',
87
- displayName: 'Event Ends',
88
- description: 'Fires when an event ends.',
89
- props: {
90
- calendar_id: common_1.googleCalendarCommon.calendarDropdown('writer'),
91
- specific_event: pieces_framework_1.Property.Checkbox({
92
- displayName: 'Target Specific Event',
93
- description: 'Enable to monitor a specific event instead of all events in the calendar.',
94
- required: false,
95
- defaultValue: false,
96
- }),
97
- event_id: common_1.googleCalendarCommon.eventDropdown(false),
98
- },
99
- type: pieces_framework_2.TriggerStrategy.POLLING,
100
- sampleData: {
101
- kind: 'calendar#event',
102
- etag: '"3419997894982000"',
103
- id: 'sample_event_id_67890',
104
- status: 'confirmed',
105
- htmlLink: 'https://www.google.com/calendar/event?eid=c2FtcGxlX2V2ZW50X2lkXzY3ODkw',
106
- created: '2025-08-14T09:00:00.000Z',
107
- updated: '2025-08-14T09:00:00.000Z',
108
- summary: 'Project Deadline',
109
- creator: { email: 'manager@example.com' },
110
- organizer: {
111
- email: 'manager@example.com',
112
- self: true,
113
- },
114
- start: {
115
- dateTime: '2025-08-14T14:30:00+05:30',
116
- timeZone: 'Asia/Kolkata',
117
- },
118
- end: {
119
- dateTime: '2025-08-14T15:30:00+05:30',
120
- timeZone: 'Asia/Kolkata',
121
- },
122
- iCalUID: 'sample_event_id_67890@google.com',
123
- sequence: 0,
124
- reminders: { useDefault: true },
125
- eventType: 'default',
126
- },
127
- onEnable(context) {
128
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
129
- yield pieces_common_1.pollingHelper.onEnable(polling, {
130
- auth: context.auth,
131
- store: context.store,
132
- propsValue: context.propsValue,
133
- });
134
- });
135
- },
136
- onDisable(context) {
137
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
138
- yield pieces_common_1.pollingHelper.onDisable(polling, {
139
- auth: context.auth,
140
- store: context.store,
141
- propsValue: context.propsValue,
142
- });
143
- });
144
- },
145
- run(context) {
146
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
147
- return yield pieces_common_1.pollingHelper.poll(polling, {
148
- auth: context.auth,
149
- store: context.store,
150
- propsValue: context.propsValue,
151
- files: context.files,
152
- });
153
- });
154
- },
155
- test(context) {
156
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
157
- return yield pieces_common_1.pollingHelper.test(polling, {
158
- auth: context.auth,
159
- store: context.store,
160
- propsValue: context.propsValue,
161
- files: context.files,
162
- });
163
- });
164
- },
165
- });
166
- //# sourceMappingURL=event-ends.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"event-ends.js","sourceRoot":"","sources":["../../../../src/lib/triggers/event-ends.ts"],"names":[],"mappings":";;;;AAAA,qEAIwC;AACxC,qEAAiE;AACjE,sCAAqF;AAErF,+DAIqC;AACrC,+DAKqC;AAMrC,MAAM,OAAO,GAOT;IACF,QAAQ,EAAE,8BAAc,CAAC,SAAS;IAClC,KAAK,EAAE,KAA+C,EAAE,oDAA1C,EAAE,IAAI,EAAE,UAAU,EAAE,gBAAgB,EAAE;;QAClD,IAAI,gBAAgB,KAAK,CAAC,EAAE,CAAC;YAC3B,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,cAAc,EAAE,QAAQ,EAAE,GAAG,UAAU,CAAC;QAEzE,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,IAAI,cAAc,IAAI,CAAC,QAAQ,EAAE,CAAC;YAChC,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,IAAI,MAAM,GAA0B,EAAE,CAAC;QAEvC,IAAI,cAAc,IAAI,QAAQ,EAAE,CAAC;YAC/B,MAAM,YAAY,GAAgB;gBAChC,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,GAAG,EAAE,GAAG,6BAAoB,CAAC,OAAO,cAAc,UAAU,WAAW,QAAQ,EAAE;gBACjF,cAAc,EAAE;oBACd,IAAI,EAAE,kCAAkB,CAAC,YAAY;oBACrC,KAAK,EAAE,MAAM,IAAA,uBAAc,EAAC,IAAI,CAAC;iBAClC;aACF,CAAC;YAEF,IAAI,CAAC;gBACH,MAAM,aAAa,GA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AAI,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"}
@@ -1,75 +0,0 @@
1
- import { TriggerStrategy } from '@activepieces/pieces-framework';
2
- export declare const eventStartTimeBefore: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
3
- serviceAccount: import("@activepieces/pieces-framework").ShortTextProperty<true>;
4
- userEmail: import("@activepieces/pieces-framework").ShortTextProperty<false>;
5
- }>)[], {
6
- calendar_id: import("@activepieces/pieces-framework").DropdownProperty<string, true, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
7
- serviceAccount: import("@activepieces/pieces-framework").ShortTextProperty<true>;
8
- userEmail: import("@activepieces/pieces-framework").ShortTextProperty<false>;
9
- }>)[]>;
10
- specific_event: import("@activepieces/pieces-framework").CheckboxProperty<false>;
11
- event_id: import("@activepieces/pieces-framework").DropdownProperty<string, false, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
12
- serviceAccount: import("@activepieces/pieces-framework").ShortTextProperty<true>;
13
- userEmail: import("@activepieces/pieces-framework").ShortTextProperty<false>;
14
- }>)[]> | import("@activepieces/pieces-framework").DropdownProperty<string, true, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
15
- serviceAccount: import("@activepieces/pieces-framework").ShortTextProperty<true>;
16
- userEmail: import("@activepieces/pieces-framework").ShortTextProperty<false>;
17
- }>)[]>;
18
- time_value: import("@activepieces/pieces-framework").NumberProperty<true>;
19
- time_unit: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
20
- }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
21
- serviceAccount: import("@activepieces/pieces-framework").ShortTextProperty<true>;
22
- userEmail: import("@activepieces/pieces-framework").ShortTextProperty<false>;
23
- }>)[], {
24
- calendar_id: import("@activepieces/pieces-framework").DropdownProperty<string, true, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
25
- serviceAccount: import("@activepieces/pieces-framework").ShortTextProperty<true>;
26
- userEmail: import("@activepieces/pieces-framework").ShortTextProperty<false>;
27
- }>)[]>;
28
- specific_event: import("@activepieces/pieces-framework").CheckboxProperty<false>;
29
- event_id: import("@activepieces/pieces-framework").DropdownProperty<string, false, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
30
- serviceAccount: import("@activepieces/pieces-framework").ShortTextProperty<true>;
31
- userEmail: import("@activepieces/pieces-framework").ShortTextProperty<false>;
32
- }>)[]> | import("@activepieces/pieces-framework").DropdownProperty<string, true, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
33
- serviceAccount: import("@activepieces/pieces-framework").ShortTextProperty<true>;
34
- userEmail: import("@activepieces/pieces-framework").ShortTextProperty<false>;
35
- }>)[]>;
36
- time_value: import("@activepieces/pieces-framework").NumberProperty<true>;
37
- time_unit: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
38
- }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.MANUAL, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
39
- serviceAccount: import("@activepieces/pieces-framework").ShortTextProperty<true>;
40
- userEmail: import("@activepieces/pieces-framework").ShortTextProperty<false>;
41
- }>)[], {
42
- calendar_id: import("@activepieces/pieces-framework").DropdownProperty<string, true, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
43
- serviceAccount: import("@activepieces/pieces-framework").ShortTextProperty<true>;
44
- userEmail: import("@activepieces/pieces-framework").ShortTextProperty<false>;
45
- }>)[]>;
46
- specific_event: import("@activepieces/pieces-framework").CheckboxProperty<false>;
47
- event_id: import("@activepieces/pieces-framework").DropdownProperty<string, false, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
48
- serviceAccount: import("@activepieces/pieces-framework").ShortTextProperty<true>;
49
- userEmail: import("@activepieces/pieces-framework").ShortTextProperty<false>;
50
- }>)[]> | import("@activepieces/pieces-framework").DropdownProperty<string, true, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
51
- serviceAccount: import("@activepieces/pieces-framework").ShortTextProperty<true>;
52
- userEmail: import("@activepieces/pieces-framework").ShortTextProperty<false>;
53
- }>)[]>;
54
- time_value: import("@activepieces/pieces-framework").NumberProperty<true>;
55
- time_unit: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
56
- }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
57
- serviceAccount: import("@activepieces/pieces-framework").ShortTextProperty<true>;
58
- userEmail: import("@activepieces/pieces-framework").ShortTextProperty<false>;
59
- }>)[], {
60
- calendar_id: import("@activepieces/pieces-framework").DropdownProperty<string, true, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
61
- serviceAccount: import("@activepieces/pieces-framework").ShortTextProperty<true>;
62
- userEmail: import("@activepieces/pieces-framework").ShortTextProperty<false>;
63
- }>)[]>;
64
- specific_event: import("@activepieces/pieces-framework").CheckboxProperty<false>;
65
- event_id: import("@activepieces/pieces-framework").DropdownProperty<string, false, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
66
- serviceAccount: import("@activepieces/pieces-framework").ShortTextProperty<true>;
67
- userEmail: import("@activepieces/pieces-framework").ShortTextProperty<false>;
68
- }>)[]> | import("@activepieces/pieces-framework").DropdownProperty<string, true, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
69
- serviceAccount: import("@activepieces/pieces-framework").ShortTextProperty<true>;
70
- userEmail: import("@activepieces/pieces-framework").ShortTextProperty<false>;
71
- }>)[]>;
72
- time_value: import("@activepieces/pieces-framework").NumberProperty<true>;
73
- time_unit: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
74
- }>;
75
- //# sourceMappingURL=event-start-time-before.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"event-start-time-before.d.ts","sourceRoot":"","sources":["../../../../src/lib/triggers/event-start-time-before.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AA2HjE,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuE/B,CAAC"}
@@ -1,160 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.eventStartTimeBefore = void 0;
4
- const tslib_1 = require("tslib");
5
- const pieces_framework_1 = require("@activepieces/pieces-framework");
6
- const pieces_framework_2 = require("@activepieces/pieces-framework");
7
- const common_1 = require("../common");
8
- const pieces_common_1 = require("@activepieces/pieces-common");
9
- const pieces_common_2 = require("@activepieces/pieces-common");
10
- const polling = {
11
- strategy: pieces_common_1.DedupeStrategy.TIMEBASED,
12
- items: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth, propsValue }) {
13
- var _b, _c, _d, _e;
14
- const { calendar_id, specific_event, event_id, time_value, time_unit } = propsValue;
15
- if (!calendar_id || !time_value || !time_unit) {
16
- return [];
17
- }
18
- if (specific_event && !event_id) {
19
- return [];
20
- }
21
- let offset_ms = time_value * 60 * 1000;
22
- if (time_unit === 'hours') {
23
- offset_ms = time_value * 60 * 60 * 1000;
24
- }
25
- else if (time_unit === 'days') {
26
- offset_ms = time_value * 24 * 60 * 60 * 1000;
27
- }
28
- const now = Date.now();
29
- const pollingIntervalMs = 5 * 60 * 1000;
30
- const timeMin = new Date(now + offset_ms).toISOString();
31
- const timeMax = new Date(now + offset_ms + pollingIntervalMs).toISOString();
32
- let events = [];
33
- if (specific_event && event_id) {
34
- const eventRequest = {
35
- method: pieces_common_2.HttpMethod.GET,
36
- url: `${common_1.googleCalendarCommon.baseUrl}/calendars/${calendar_id}/events/${event_id}`,
37
- authentication: {
38
- type: pieces_common_2.AuthenticationType.BEARER_TOKEN,
39
- token: yield (0, common_1.getAccessToken)(auth),
40
- },
41
- };
42
- try {
43
- const eventResponse = yield pieces_common_2.httpClient.sendRequest(eventRequest);
44
- const event = eventResponse.body;
45
- // Check if this specific event falls within our time window
46
- const eventStartTime = new Date((_e = (_c = (_b = event.start) === null || _b === void 0 ? void 0 : _b.dateTime) !== null && _c !== void 0 ? _c : (_d = event.start) === null || _d === void 0 ? void 0 : _d.date) !== null && _e !== void 0 ? _e : 0).getTime();
47
- const triggerTime = eventStartTime - offset_ms;
48
- if (triggerTime >= now && triggerTime <= now + pollingIntervalMs) {
49
- events = [event];
50
- }
51
- }
52
- catch (error) {
53
- console.error('Error fetching specific event:', error);
54
- return [];
55
- }
56
- }
57
- else {
58
- const request = {
59
- method: pieces_common_2.HttpMethod.GET,
60
- url: `${common_1.googleCalendarCommon.baseUrl}/calendars/${calendar_id}/events`,
61
- authentication: {
62
- type: pieces_common_2.AuthenticationType.BEARER_TOKEN,
63
- token: yield (0, common_1.getAccessToken)(auth),
64
- },
65
- queryParams: {
66
- singleEvents: 'true',
67
- orderBy: 'startTime',
68
- timeMin: timeMin,
69
- timeMax: timeMax,
70
- },
71
- };
72
- const response = yield pieces_common_2.httpClient.sendRequest(request);
73
- events = response.body.items;
74
- }
75
- return events.map((event) => {
76
- var _a, _b, _c, _d;
77
- const startTime = new Date((_d = (_b = (_a = event.start) === null || _a === void 0 ? void 0 : _a.dateTime) !== null && _b !== void 0 ? _b : (_c = event.start) === null || _c === void 0 ? void 0 : _c.date) !== null && _d !== void 0 ? _d : 0).getTime();
78
- const triggerTime = startTime - offset_ms;
79
- return {
80
- epochMilliSeconds: triggerTime,
81
- data: event,
82
- };
83
- });
84
- }),
85
- };
86
- exports.eventStartTimeBefore = (0, pieces_framework_1.createTrigger)({
87
- auth: common_1.googleCalendarAuth,
88
- name: 'event_starts_in',
89
- displayName: 'Event Start (Time Before)',
90
- description: 'Fires at a specified amount of time before an event starts (e.g., a reminder).',
91
- props: {
92
- calendar_id: common_1.googleCalendarCommon.calendarDropdown('writer'),
93
- specific_event: pieces_framework_1.Property.Checkbox({
94
- displayName: 'Target Specific Event',
95
- description: 'Enable to monitor a specific event instead of all events in the calendar.',
96
- required: false,
97
- defaultValue: false,
98
- }),
99
- event_id: common_1.googleCalendarCommon.eventDropdown(false),
100
- time_value: pieces_framework_1.Property.Number({
101
- displayName: 'Time Before',
102
- description: 'The amount of time before the event starts.',
103
- required: true,
104
- defaultValue: 15,
105
- }),
106
- time_unit: pieces_framework_1.Property.StaticDropdown({
107
- displayName: 'Time Unit',
108
- required: true,
109
- options: {
110
- options: [
111
- { label: 'Minutes', value: 'minutes' },
112
- { label: 'Hours', value: 'hours' },
113
- { label: 'Days', value: 'days' },
114
- ],
115
- },
116
- defaultValue: 'minutes',
117
- }),
118
- },
119
- type: pieces_framework_2.TriggerStrategy.POLLING,
120
- sampleData: {},
121
- onEnable(context) {
122
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
123
- yield pieces_common_1.pollingHelper.onEnable(polling, {
124
- auth: context.auth,
125
- store: context.store,
126
- propsValue: context.propsValue,
127
- });
128
- });
129
- },
130
- onDisable(context) {
131
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
132
- yield pieces_common_1.pollingHelper.onDisable(polling, {
133
- auth: context.auth,
134
- store: context.store,
135
- propsValue: context.propsValue,
136
- });
137
- });
138
- },
139
- run(context) {
140
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
141
- return yield pieces_common_1.pollingHelper.poll(polling, {
142
- auth: context.auth,
143
- store: context.store,
144
- propsValue: context.propsValue,
145
- files: context.files,
146
- });
147
- });
148
- },
149
- test(context) {
150
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
151
- return yield pieces_common_1.pollingHelper.test(polling, {
152
- auth: context.auth,
153
- store: context.store,
154
- propsValue: context.propsValue,
155
- files: context.files,
156
- });
157
- });
158
- },
159
- });
160
- //# sourceMappingURL=event-start-time-before.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"event-start-time-before.js","sourceRoot":"","sources":["../../../../src/lib/triggers/event-start-time-before.ts"],"names":[],"mappings":";;;;AAAA,qEAKwC;AACxC,qEAAiE;AACjE,sCAAqF;AAErF,+DAIqC;AACrC,+DAKqC;AAMrC,MAAM,OAAO,GAST;IACF,QAAQ,EAAE,8BAAc,CAAC,SAAS;IAClC,KAAK,EAAE,KAA6B,EAAE,oDAAxB,EAAE,IAAI,EAAE,UAAU,EAAE;;QAChC,MAAM,EAAE,WAAW,EAAE,cAAc,E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ggerStrategy } from '@activepieces/pieces-framework';
2
- export declare const newCalendar: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
3
- serviceAccount: import("@activepieces/pieces-framework").ShortTextProperty<true>;
4
- userEmail: import("@activepieces/pieces-framework").ShortTextProperty<false>;
5
- }>)[], {
6
- access_role_filter: import("@activepieces/pieces-framework").StaticMultiSelectDropdownProperty<string, false>;
7
- calendar_name_filter: import("@activepieces/pieces-framework").ShortTextProperty<false>;
8
- exclude_shared: import("@activepieces/pieces-framework").CheckboxProperty<false>;
9
- }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
10
- serviceAccount: import("@activepieces/pieces-framework").ShortTextProperty<true>;
11
- userEmail: import("@activepieces/pieces-framework").ShortTextProperty<false>;
12
- }>)[], {
13
- access_role_filter: import("@activepieces/pieces-framework").StaticMultiSelectDropdownProperty<string, false>;
14
- calendar_name_filter: import("@activepieces/pieces-framework").ShortTextProperty<false>;
15
- exclude_shared: import("@activepieces/pieces-framework").CheckboxProperty<false>;
16
- }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.MANUAL, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
17
- serviceAccount: import("@activepieces/pieces-framework").ShortTextProperty<true>;
18
- userEmail: import("@activepieces/pieces-framework").ShortTextProperty<false>;
19
- }>)[], {
20
- access_role_filter: import("@activepieces/pieces-framework").StaticMultiSelectDropdownProperty<string, false>;
21
- calendar_name_filter: import("@activepieces/pieces-framework").ShortTextProperty<false>;
22
- exclude_shared: import("@activepieces/pieces-framework").CheckboxProperty<false>;
23
- }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
24
- serviceAccount: import("@activepieces/pieces-framework").ShortTextProperty<true>;
25
- userEmail: import("@activepieces/pieces-framework").ShortTextProperty<false>;
26
- }>)[], {
27
- access_role_filter: import("@activepieces/pieces-framework").StaticMultiSelectDropdownProperty<string, false>;
28
- calendar_name_filter: import("@activepieces/pieces-framework").ShortTextProperty<false>;
29
- exclude_shared: import("@activepieces/pieces-framework").CheckboxProperty<false>;
30
- }>;
31
- //# sourceMappingURL=new-calendar.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"new-calendar.d.ts","sourceRoot":"","sources":["../../../../src/lib/triggers/new-calendar.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AA2EjE,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0HtB,CAAC"}
@@ -1,151 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.newCalendar = void 0;
4
- const tslib_1 = require("tslib");
5
- const pieces_framework_1 = require("@activepieces/pieces-framework");
6
- const pieces_framework_2 = require("@activepieces/pieces-framework");
7
- const common_1 = require("../common");
8
- const pieces_common_1 = require("@activepieces/pieces-common");
9
- const helper_1 = require("../common/helper");
10
- const polling = {
11
- strategy: pieces_common_1.DedupeStrategy.LAST_ITEM,
12
- items: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth, store, propsValue }) {
13
- const { access_role_filter, calendar_name_filter, exclude_shared } = propsValue;
14
- const currentCalendars = yield (0, helper_1.getCalendars)(auth);
15
- let filteredCalendars = currentCalendars;
16
- if (access_role_filter && access_role_filter.length > 0) {
17
- filteredCalendars = filteredCalendars.filter((cal) => access_role_filter.includes(cal.accessRole));
18
- }
19
- if (calendar_name_filter && calendar_name_filter.trim()) {
20
- const searchTerm = calendar_name_filter.toLowerCase().trim();
21
- filteredCalendars = filteredCalendars.filter((cal) => {
22
- var _a, _b;
23
- return ((_a = cal.summary) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(searchTerm)) ||
24
- ((_b = cal.description) === null || _b === void 0 ? void 0 : _b.toLowerCase().includes(searchTerm));
25
- });
26
- }
27
- if (exclude_shared) {
28
- filteredCalendars = filteredCalendars.filter((cal) => cal.accessRole === 'owner' || cal.primary);
29
- }
30
- const currentCalendarIds = filteredCalendars.map((cal) => cal.id);
31
- const oldCalendarIds = (yield store.get('calendars')) || [];
32
- const oldCalendarIdsSet = new Set(oldCalendarIds);
33
- const newCalendars = filteredCalendars.filter((cal) => !oldCalendarIdsSet.has(cal.id));
34
- yield store.put('calendars', currentCalendarIds);
35
- return newCalendars.map((cal) => ({
36
- id: cal.id,
37
- data: Object.assign(Object.assign({}, cal), { isOwned: cal.accessRole === 'owner' || cal.primary, isShared: cal.accessRole !== 'owner' && !cal.primary, calendarType: cal.primary
38
- ? 'primary'
39
- : cal.accessRole === 'owner'
40
- ? 'owned'
41
- : 'shared' }),
42
- }));
43
- }),
44
- };
45
- exports.newCalendar = (0, pieces_framework_1.createTrigger)({
46
- auth: common_1.googleCalendarAuth,
47
- name: 'new_calendar',
48
- displayName: 'New Calendar',
49
- description: 'Fires when a new calendar is created or becomes accessible.',
50
- props: {
51
- access_role_filter: pieces_framework_1.Property.StaticMultiSelectDropdown({
52
- displayName: 'Access Role Filter',
53
- description: 'Only trigger for calendars with specific access roles (optional)',
54
- required: false,
55
- options: {
56
- options: [
57
- { label: 'Owner', value: 'owner' },
58
- { label: 'Writer', value: 'writer' },
59
- { label: 'Reader', value: 'reader' },
60
- { label: 'Free/Busy Reader', value: 'freeBusyReader' },
61
- ],
62
- },
63
- }),
64
- calendar_name_filter: pieces_framework_1.Property.ShortText({
65
- displayName: 'Calendar Name Filter',
66
- description: 'Only trigger for calendars containing this text in name or description (optional)',
67
- required: false,
68
- }),
69
- exclude_shared: pieces_framework_1.Property.Checkbox({
70
- displayName: 'Exclude Shared Calendars',
71
- description: 'Only trigger for calendars you own, not shared calendars',
72
- required: false,
73
- defaultValue: false,
74
- }),
75
- },
76
- type: pieces_framework_2.TriggerStrategy.POLLING,
77
- sampleData: {
78
- id: 'sample_calendar_id@group.calendar.google.com',
79
- summary: 'New Project Team Calendar',
80
- description: 'A shared calendar for the new project team.',
81
- timeZone: 'Asia/Kolkata',
82
- backgroundColor: '#9fe1e7',
83
- foregroundColor: '#000000',
84
- accessRole: 'owner',
85
- isOwned: true,
86
- isShared: false,
87
- calendarType: 'owned',
88
- primary: false,
89
- },
90
- onEnable(context) {
91
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
92
- const calendars = yield (0, helper_1.getCalendars)(context.auth);
93
- const { access_role_filter, calendar_name_filter, exclude_shared } = context.propsValue;
94
- let filteredCalendars = calendars;
95
- if (access_role_filter && access_role_filter.length > 0) {
96
- filteredCalendars = filteredCalendars.filter((cal) => access_role_filter.includes(cal.accessRole));
97
- }
98
- if (calendar_name_filter && calendar_name_filter.trim()) {
99
- const searchTerm = calendar_name_filter.toLowerCase().trim();
100
- filteredCalendars = filteredCalendars.filter((cal) => {
101
- var _a, _b;
102
- return ((_a = cal.summary) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(searchTerm)) ||
103
- ((_b = cal.description) === null || _b === void 0 ? void 0 : _b.toLowerCase().includes(searchTerm));
104
- });
105
- }
106
- if (exclude_shared) {
107
- filteredCalendars = filteredCalendars.filter((cal) => cal.accessRole === 'owner' || cal.primary);
108
- }
109
- yield context.store.put('calendars', filteredCalendars.map((cal) => cal.id));
110
- yield pieces_common_1.pollingHelper.onEnable(polling, {
111
- auth: context.auth,
112
- store: context.store,
113
- propsValue: context.propsValue,
114
- });
115
- });
116
- },
117
- onDisable(context) {
118
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
119
- yield pieces_common_1.pollingHelper.onDisable(polling, {
120
- auth: context.auth,
121
- store: context.store,
122
- propsValue: context.propsValue,
123
- });
124
- });
125
- },
126
- run(context) {
127
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
128
- return yield pieces_common_1.pollingHelper.poll(polling, {
129
- auth: context.auth,
130
- store: context.store,
131
- propsValue: context.propsValue,
132
- files: context.files,
133
- });
134
- });
135
- },
136
- test(context) {
137
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
138
- const calendars = yield (0, helper_1.getCalendars)(context.auth);
139
- const recentCalendars = calendars.slice(-1);
140
- return recentCalendars.map((cal) => ({
141
- id: cal.id,
142
- data: Object.assign(Object.assign({}, cal), { isOwned: cal.accessRole === 'owner' || cal.primary, isShared: cal.accessRole !== 'owner' && !cal.primary, calendarType: cal.primary
143
- ? 'primary'
144
- : cal.accessRole === 'owner'
145
- ? 'owned'
146
- : 'shared' }),
147
- }));
148
- });
149
- },
150
- });
151
- //# sourceMappingURL=new-calendar.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"new-calendar.js","sourceRoot":"","sources":["../../../../src/lib/triggers/new-calendar.ts"],"names":[],"mappings":";;;;AAAA,qEAIwC;AACxC,qEAAiE;AACjE,sCAA+C;AAC/C,+DAIqC;AACrC,6CAAgD;AAGhD,MAAM,OAAO,GAOT;IACF,QAAQ,EAAE,8BAAc,CAAC,SAAS;IAClC,KAAK,EAAE,KAAoC,EAAE,oDAA/B,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE;QACvC,MAAM,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,cAAc,EAAE,GAChE,UAAU,CAAC;QAEb,MAAM,gBAAgB,GAAG,MAAM,IAAA,qBAAY,EAAC,IAAI,CAAC,CAAC;QAElD,IAAI,iBAAiB,GAAG,gBAAgB,CAAC;QAEzC,IAAI,kBAAkB,IAAI,kBAAkB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACxD,iBAAiB,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC,GAAG,E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