@activepieces/piece-google-calendar 0.4.4 → 0.5.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.
- package/package.json +6 -6
- package/src/lib/actions/create-event.d.ts +7 -0
- package/src/lib/actions/create-event.js +77 -14
- package/src/lib/actions/create-event.js.map +1 -1
- package/src/lib/actions/create-quick-event.d.ts +1 -1
- package/src/lib/common/helper.d.ts +1 -1
- package/src/lib/common/helper.js +3 -3
- package/src/lib/common/helper.js.map +1 -1
- package/src/lib/triggers/calendar-event.d.ts +3 -0
- package/src/lib/triggers/calendar-event.js +24 -6
- package/src/lib/triggers/calendar-event.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@activepieces/piece-google-calendar",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@sinclair/typebox": "0.26.8",
|
|
6
6
|
"axios": "^1.6.3",
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
"is-base64": "1.1.0",
|
|
11
11
|
"lodash": "4.17.21",
|
|
12
12
|
"nanoid": "3.3.6",
|
|
13
|
-
"semver": "7.
|
|
14
|
-
"@activepieces/pieces-common": "0.2.
|
|
15
|
-
"@activepieces/pieces-framework": "0.7.
|
|
16
|
-
"@activepieces/shared": "0.10.
|
|
17
|
-
"tslib": "
|
|
13
|
+
"semver": "7.6.0",
|
|
14
|
+
"@activepieces/pieces-common": "0.2.9",
|
|
15
|
+
"@activepieces/pieces-framework": "0.7.22",
|
|
16
|
+
"@activepieces/shared": "0.10.91",
|
|
17
|
+
"tslib": "2.6.2"
|
|
18
18
|
},
|
|
19
19
|
"main": "./src/index.js",
|
|
20
20
|
"type": "commonjs"
|
|
@@ -3,4 +3,11 @@ export declare const createEvent: import("@activepieces/pieces-framework").IActi
|
|
|
3
3
|
title: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
4
|
start_date_time: import("@activepieces/pieces-framework").DateTimeProperty<true>;
|
|
5
5
|
end_date_time: import("@activepieces/pieces-framework").DateTimeProperty<false>;
|
|
6
|
+
location: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
7
|
+
description: import("@activepieces/pieces-framework").LongTextProperty<false>;
|
|
8
|
+
attendees: import("@activepieces/pieces-framework").ArrayProperty<false>;
|
|
9
|
+
guests_can_modify: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
10
|
+
guests_can_invite_others: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
11
|
+
guests_can_see_other_guests: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
12
|
+
send_notifications: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
6
13
|
}>;
|
|
@@ -3,10 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.createEvent = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
-
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
6
|
const common_1 = require("../common");
|
|
8
7
|
const dayjs_1 = tslib_1.__importDefault(require("dayjs"));
|
|
9
8
|
const __1 = require("../../");
|
|
9
|
+
const googleapis_1 = require("googleapis");
|
|
10
|
+
const googleapis_common_1 = require("googleapis-common");
|
|
10
11
|
exports.createEvent = (0, pieces_framework_1.createAction)({
|
|
11
12
|
auth: __1.googleCalendarAuth,
|
|
12
13
|
name: 'create_google_calendar_event',
|
|
@@ -27,12 +28,57 @@ exports.createEvent = (0, pieces_framework_1.createAction)({
|
|
|
27
28
|
description: "By default it'll be 30 min post start time",
|
|
28
29
|
required: false,
|
|
29
30
|
}),
|
|
31
|
+
location: pieces_framework_1.Property.ShortText({
|
|
32
|
+
displayName: 'Location',
|
|
33
|
+
required: false,
|
|
34
|
+
}),
|
|
35
|
+
/*attachment: Property.ShortText({
|
|
36
|
+
displayName: 'Attachment',
|
|
37
|
+
description: 'URL of the file to be attached',
|
|
38
|
+
required: false,
|
|
39
|
+
}),*/
|
|
40
|
+
description: pieces_framework_1.Property.LongText({
|
|
41
|
+
displayName: 'Description',
|
|
42
|
+
description: 'Description of the event. You can use HTML tags here.',
|
|
43
|
+
required: false,
|
|
44
|
+
}),
|
|
45
|
+
attendees: pieces_framework_1.Property.Array({
|
|
46
|
+
displayName: 'Attendees',
|
|
47
|
+
description: 'Emails of the attendees (guests)',
|
|
48
|
+
required: false,
|
|
49
|
+
}),
|
|
50
|
+
guests_can_modify: pieces_framework_1.Property.Checkbox({
|
|
51
|
+
displayName: 'Guests can modify',
|
|
52
|
+
defaultValue: false,
|
|
53
|
+
required: false,
|
|
54
|
+
}),
|
|
55
|
+
guests_can_invite_others: pieces_framework_1.Property.Checkbox({
|
|
56
|
+
displayName: 'Guests can invite others',
|
|
57
|
+
defaultValue: false,
|
|
58
|
+
required: false,
|
|
59
|
+
}),
|
|
60
|
+
guests_can_see_other_guests: pieces_framework_1.Property.Checkbox({
|
|
61
|
+
displayName: 'Guests can see other guests',
|
|
62
|
+
defaultValue: false,
|
|
63
|
+
required: false,
|
|
64
|
+
}),
|
|
65
|
+
send_notifications: pieces_framework_1.Property.StaticDropdown({
|
|
66
|
+
displayName: 'Send Notifications',
|
|
67
|
+
defaultValue: 'all',
|
|
68
|
+
options: {
|
|
69
|
+
options: [
|
|
70
|
+
{ label: 'Yes, to everyone', value: 'all' },
|
|
71
|
+
{ label: 'To non-Google Calendar guests only', value: 'externalOnly' },
|
|
72
|
+
{ label: 'To no one', value: 'none' },
|
|
73
|
+
],
|
|
74
|
+
},
|
|
75
|
+
required: true,
|
|
76
|
+
}),
|
|
30
77
|
},
|
|
31
78
|
run(configValue) {
|
|
32
79
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
33
80
|
// docs: https://developers.google.com/calendar/api/v3/reference/events/insert
|
|
34
|
-
const { calendar_id: calendarId, title: summary, start_date_time, end_date_time, } = configValue.propsValue;
|
|
35
|
-
const { access_token: token } = configValue.auth;
|
|
81
|
+
const { calendar_id: calendarId, title: summary, start_date_time, end_date_time, location, description, guests_can_modify: guestsCanModify, guests_can_invite_others: guestsCanInviteOthers, guests_can_see_other_guests: guestsCanSeeOtherGuests, } = configValue.propsValue;
|
|
36
82
|
const start = {
|
|
37
83
|
dateTime: (0, dayjs_1.default)(start_date_time).format('YYYY-MM-DDTHH:mm:ss.sssZ'),
|
|
38
84
|
};
|
|
@@ -42,21 +88,38 @@ exports.createEvent = (0, pieces_framework_1.createAction)({
|
|
|
42
88
|
const end = {
|
|
43
89
|
dateTime: (0, dayjs_1.default)(endTime).format('YYYY-MM-DDTHH:mm:ss.sssZ'),
|
|
44
90
|
};
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
91
|
+
/*const attachment = {
|
|
92
|
+
fileUrl: configValue.propsValue.attachment,
|
|
93
|
+
};*/
|
|
94
|
+
const attendeesArray = configValue.propsValue.attendees;
|
|
95
|
+
const sendNotifications = configValue.propsValue.send_notifications;
|
|
96
|
+
const attendeesObject = [];
|
|
97
|
+
if (attendeesArray) {
|
|
98
|
+
for (const attendee of attendeesArray) {
|
|
99
|
+
attendeesObject.push({ email: attendee });
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
console.log;
|
|
103
|
+
const authClient = new googleapis_common_1.OAuth2Client();
|
|
104
|
+
authClient.setCredentials(configValue.auth);
|
|
105
|
+
const calendar = googleapis_1.google.calendar({ version: 'v3', auth: authClient });
|
|
106
|
+
const response = yield calendar.events.insert({
|
|
107
|
+
calendarId,
|
|
108
|
+
sendUpdates: sendNotifications,
|
|
109
|
+
requestBody: {
|
|
50
110
|
summary,
|
|
51
111
|
start,
|
|
52
112
|
end,
|
|
113
|
+
//attachments: configValue.propsValue.attachment ? [attachment] : [],
|
|
114
|
+
location: location !== null && location !== void 0 ? location : "",
|
|
115
|
+
description: description !== null && description !== void 0 ? description : "",
|
|
116
|
+
attendees: attendeesObject,
|
|
117
|
+
guestsCanInviteOthers,
|
|
118
|
+
guestsCanModify,
|
|
119
|
+
guestsCanSeeOtherGuests,
|
|
53
120
|
},
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
token,
|
|
57
|
-
},
|
|
58
|
-
};
|
|
59
|
-
return yield pieces_common_1.httpClient.sendRequest(request);
|
|
121
|
+
});
|
|
122
|
+
return response.data;
|
|
60
123
|
});
|
|
61
124
|
},
|
|
62
125
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-event.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/google-calendar/src/lib/actions/create-event.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE
|
|
1
|
+
{"version":3,"file":"create-event.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/google-calendar/src/lib/actions/create-event.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,sCAAiD;AACjD,0DAA0B;AAC1B,8BAA4C;AAC5C,2CAAoC;AACpC,yDAAiD;AAEpC,QAAA,WAAW,GAAG,IAAA,+BAAY,EAAC;IACtC,IAAI,EAAE,sBAAkB;IACxB,IAAI,EAAE,8BAA8B;IACpC,WAAW,EAAE,WAAW;IACxB,WAAW,EAAE,cAAc;IAC3B,KAAK,EAAE;QACL,WAAW,EAAE,6BAAoB,CAAC,gBAAgB,CAAC,QAAQ,CAAC;QAC5D,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACxB,WAAW,EAAE,oBAAoB;YACjC,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,eAAe,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACjC,WAAW,EAAE,8BAA8B;YAC3C,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,aAAa,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YAC/B,WAAW,EAAE,4BAA4B;YACzC,WAAW,EAAE,4CAA4C;YACzD,QA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AAQ,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;gBAC5C,UAAU;gBACV,WAAW,EAAE,iBAAiB;gBAC9B,WAAW,EAAE;oBACX,OAAO;oBACP,KAAK;oBACL,GAAG;oBACH,qEAAqE;oBACrE,QAAQ,EAAE,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,EAAE;oBACxB,WAAW,EAAE,WAAW,aAAX,WAAW,cAAX,WAAW,GAAI,EAAE;oBAC9B,SAAS,EAAE,eAAe;oBAC1B,qBAAqB;oBACrB,eAAe;oBACf,uBAAuB;iBACxB;aACF,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const createQuickCalendarEvent: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
|
|
2
2
|
calendar_id: import("@activepieces/pieces-framework").DropdownProperty<string, false> | import("@activepieces/pieces-framework").DropdownProperty<string, true>;
|
|
3
3
|
text: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
4
|
-
send_updates: import("@activepieces/pieces-framework").StaticDropdownProperty<string,
|
|
4
|
+
send_updates: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true> | import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
|
|
5
5
|
}>;
|
|
@@ -3,5 +3,5 @@ import { GoogleWatchResponse, CalendarObject, GoogleCalendarEvent } from './type
|
|
|
3
3
|
export declare function stopWatchEvent(body: GoogleWatchResponse, authProp: OAuth2PropertyValue): Promise<void>;
|
|
4
4
|
export declare function watchEvent(calendarId: string, webhookUrl: string, authProp: OAuth2PropertyValue): Promise<GoogleWatchResponse>;
|
|
5
5
|
export declare function getCalendars(authProp: OAuth2PropertyValue, minAccessRole?: 'writer'): Promise<CalendarObject[]>;
|
|
6
|
-
export declare function getEvents(calendarId: string, authProp: OAuth2PropertyValue, minUpdated?: Date): Promise<GoogleCalendarEvent[]>;
|
|
6
|
+
export declare function getEvents(calendarId: string, expandRecurringEvent: boolean, authProp: OAuth2PropertyValue, minUpdated?: Date): Promise<GoogleCalendarEvent[]>;
|
|
7
7
|
export declare function getLatestEvent(calendarId: string, authProp: OAuth2PropertyValue): Promise<GoogleCalendarEvent>;
|
package/src/lib/common/helper.js
CHANGED
|
@@ -67,7 +67,7 @@ function getCalendars(authProp, minAccessRole) {
|
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
69
|
exports.getCalendars = getCalendars;
|
|
70
|
-
function getEvents(calendarId, authProp, minUpdated) {
|
|
70
|
+
function getEvents(calendarId, expandRecurringEvent, authProp, minUpdated) {
|
|
71
71
|
var _a;
|
|
72
72
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
73
73
|
// docs: https://developers.google.com/calendar/api/v3/reference/events/list
|
|
@@ -78,7 +78,7 @@ function getEvents(calendarId, authProp, minUpdated) {
|
|
|
78
78
|
updatedMin: (_a = minUpdated === null || minUpdated === void 0 ? void 0 : minUpdated.toISOString()) !== null && _a !== void 0 ? _a : yesterday.toISOString(),
|
|
79
79
|
maxResults: '2500',
|
|
80
80
|
orderBy: 'updated',
|
|
81
|
-
singleEvents: 'true',
|
|
81
|
+
singleEvents: expandRecurringEvent ? 'true' : 'false',
|
|
82
82
|
showDeleted: 'true',
|
|
83
83
|
};
|
|
84
84
|
const request = {
|
|
@@ -106,7 +106,7 @@ function getEvents(calendarId, authProp, minUpdated) {
|
|
|
106
106
|
exports.getEvents = getEvents;
|
|
107
107
|
function getLatestEvent(calendarId, authProp) {
|
|
108
108
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
109
|
-
const eventList = yield getEvents(calendarId, authProp);
|
|
109
|
+
const eventList = yield getEvents(calendarId, false, authProp);
|
|
110
110
|
const lastUpdatedEvent = eventList.pop(); // You can retrieve the last updated event.
|
|
111
111
|
return lastUpdatedEvent;
|
|
112
112
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helper.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/google-calendar/src/lib/common/helper.ts"],"names":[],"mappings":";;;;AACA,+DAKqC;AACrC,mCAAoC;AACpC,wBAAyC;AACzC,mCAOiB;AAEjB,SAAsB,cAAc,
|
|
1
|
+
{"version":3,"file":"helper.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/google-calendar/src/lib/common/helper.ts"],"names":[],"mappings":";;;;AACA,+DAKqC;AACrC,mCAAoC;AACpC,wBAAyC;AACzC,mCAOiB;AAEjB,SAAsB,cAAc,CAAC,IAAyB,EAAE,QAA6B;;QAC5F,MAAM,OAAO,GAAgB;YAC5B,MAAM,EAAE,0BAAU,CAAC,IAAI;YACvB,GAAG,EAAE,GAAG,uBAAoB,CAAC,OAAO,gBAAgB;YACpD,IAAI,EAAE;gBACL,EAAE,EAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,EAAE;gBACZ,UAAU,EAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,UAAU;aAC5B;YACD,cAAc,EAAE;gBACf,IAAI,EAAE,kCAAkB,CAAC,YAAY;gBACrC,KAAK,EAAE,QAAQ,CAAC,YAAY;aAC5B;SACD,CAAC;QACF,MAAM,0BAAU,CAAC,WAAW,CAAM,OAAO,CAAC,CAAC;IAC5C,CAAC;CAAA;AAdD,wCAcC;AAED,SAAsB,UAAU,CAC/B,UAAkB,EAClB,UAAkB,EAClB,QAA6B;;QAE7B,MAAM,OAAO,GAAgB;YAC5B,MAAM,EAAE,0BAAU,CAAC,IAAI;YACvB,GAAG,EAAE,GAAG,uBAAoB,CAAC,OAAO,cAAc,UAAU,eAAe;YAC3E,IAAI,EAAE;gBACL,EAAE,EAAE,IAAA,mBAAU,GAAE;gBAChB,IAAI,EAAE,uBAAe,CAAC,OAAO;gBAC7B,OAAO,EAAE,UAAU;aACnB;YACD,cAAc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 +1,11 @@
|
|
|
1
1
|
import { TriggerStrategy } from '@activepieces/pieces-framework';
|
|
2
2
|
export declare const calendarEventChanged: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
|
|
3
3
|
calendar_id: import("@activepieces/pieces-framework").DropdownProperty<string, false> | import("@activepieces/pieces-framework").DropdownProperty<string, true>;
|
|
4
|
+
expandRecurringEvent: import("@activepieces/pieces-framework").CheckboxProperty<true>;
|
|
4
5
|
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
|
|
5
6
|
calendar_id: import("@activepieces/pieces-framework").DropdownProperty<string, false> | import("@activepieces/pieces-framework").DropdownProperty<string, true>;
|
|
7
|
+
expandRecurringEvent: import("@activepieces/pieces-framework").CheckboxProperty<true>;
|
|
6
8
|
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
|
|
7
9
|
calendar_id: import("@activepieces/pieces-framework").DropdownProperty<string, false> | import("@activepieces/pieces-framework").DropdownProperty<string, true>;
|
|
10
|
+
expandRecurringEvent: import("@activepieces/pieces-framework").CheckboxProperty<true>;
|
|
8
11
|
}>;
|
|
@@ -10,7 +10,7 @@ const __1 = require("../../");
|
|
|
10
10
|
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
11
11
|
const polling = {
|
|
12
12
|
strategy: pieces_common_1.DedupeStrategy.TIMEBASED,
|
|
13
|
-
items: ({ auth, propsValue: { calendarId }, lastFetchEpochMS }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
13
|
+
items: ({ auth, propsValue: { calendarId, expandRecurringEvent }, lastFetchEpochMS }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
14
14
|
var _a;
|
|
15
15
|
let minUpdated = new Date(lastFetchEpochMS);
|
|
16
16
|
// Google Calendar API breaks if minUpdated is too far in the past
|
|
@@ -20,7 +20,7 @@ const polling = {
|
|
|
20
20
|
yesterday.setDate(now.getDate() - 7);
|
|
21
21
|
minUpdated = yesterday;
|
|
22
22
|
}
|
|
23
|
-
const currentValues = (_a = (yield (0, helper_1.getEvents)(calendarId, auth, minUpdated))) !== null && _a !== void 0 ? _a : [];
|
|
23
|
+
const currentValues = (_a = (yield (0, helper_1.getEvents)(calendarId, expandRecurringEvent, auth, minUpdated))) !== null && _a !== void 0 ? _a : [];
|
|
24
24
|
const items = currentValues.map((item) => ({
|
|
25
25
|
epochMilliSeconds: new Date(item.updated).getTime(),
|
|
26
26
|
data: item,
|
|
@@ -36,6 +36,12 @@ exports.calendarEventChanged = (0, pieces_framework_1.createTrigger)({
|
|
|
36
36
|
description: 'Triggers when an event is added or updated',
|
|
37
37
|
props: {
|
|
38
38
|
calendar_id: common_1.googleCalendarCommon.calendarDropdown(),
|
|
39
|
+
expandRecurringEvent: pieces_framework_1.Property.Checkbox({
|
|
40
|
+
displayName: 'Expand Recurring Event?',
|
|
41
|
+
description: 'If true, the trigger will activate for every occurrence of a recurring event.',
|
|
42
|
+
required: true,
|
|
43
|
+
defaultValue: false,
|
|
44
|
+
}),
|
|
39
45
|
},
|
|
40
46
|
sampleData: {
|
|
41
47
|
kind: 'calendar#event',
|
|
@@ -89,7 +95,10 @@ exports.calendarEventChanged = (0, pieces_framework_1.createTrigger)({
|
|
|
89
95
|
return yield pieces_common_1.pollingHelper.test(polling, {
|
|
90
96
|
store,
|
|
91
97
|
auth,
|
|
92
|
-
propsValue: {
|
|
98
|
+
propsValue: {
|
|
99
|
+
calendarId: propsValue.calendar_id,
|
|
100
|
+
expandRecurringEvent: propsValue.expandRecurringEvent,
|
|
101
|
+
},
|
|
93
102
|
});
|
|
94
103
|
});
|
|
95
104
|
},
|
|
@@ -98,7 +107,10 @@ exports.calendarEventChanged = (0, pieces_framework_1.createTrigger)({
|
|
|
98
107
|
yield pieces_common_1.pollingHelper.onEnable(polling, {
|
|
99
108
|
store,
|
|
100
109
|
auth,
|
|
101
|
-
propsValue: {
|
|
110
|
+
propsValue: {
|
|
111
|
+
calendarId: propsValue.calendar_id,
|
|
112
|
+
expandRecurringEvent: propsValue.expandRecurringEvent,
|
|
113
|
+
},
|
|
102
114
|
});
|
|
103
115
|
});
|
|
104
116
|
},
|
|
@@ -107,7 +119,10 @@ exports.calendarEventChanged = (0, pieces_framework_1.createTrigger)({
|
|
|
107
119
|
yield pieces_common_1.pollingHelper.onDisable(polling, {
|
|
108
120
|
store,
|
|
109
121
|
auth,
|
|
110
|
-
propsValue: {
|
|
122
|
+
propsValue: {
|
|
123
|
+
calendarId: propsValue.calendar_id,
|
|
124
|
+
expandRecurringEvent: propsValue.expandRecurringEvent,
|
|
125
|
+
},
|
|
111
126
|
});
|
|
112
127
|
});
|
|
113
128
|
},
|
|
@@ -116,7 +131,10 @@ exports.calendarEventChanged = (0, pieces_framework_1.createTrigger)({
|
|
|
116
131
|
return yield pieces_common_1.pollingHelper.poll(polling, {
|
|
117
132
|
store,
|
|
118
133
|
auth,
|
|
119
|
-
propsValue: {
|
|
134
|
+
propsValue: {
|
|
135
|
+
calendarId: propsValue.calendar_id,
|
|
136
|
+
expandRecurringEvent: propsValue.expandRecurringEvent,
|
|
137
|
+
},
|
|
120
138
|
});
|
|
121
139
|
});
|
|
122
140
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar-event.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/google-calendar/src/lib/triggers/calendar-event.ts"],"names":[],"mappings":";;;;AAAA,
|
|
1
|
+
{"version":3,"file":"calendar-event.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/google-calendar/src/lib/triggers/calendar-event.ts"],"names":[],"mappings":";;;;AAAA,qEAA+F;AAC/F,qEAAiE;AACjE,sCAAiD;AACjD,6CAA6C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