@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.
- package/package.json +7 -15
- package/src/index.js +106 -81
- package/src/index.d.ts +0 -6
- package/src/index.d.ts.map +0 -1
- package/src/index.js.map +0 -1
- package/src/lib/actions/add-attendees.action.d.ts +0 -12
- package/src/lib/actions/add-attendees.action.d.ts.map +0 -1
- package/src/lib/actions/add-attendees.action.js +0 -51
- package/src/lib/actions/add-attendees.action.js.map +0 -1
- package/src/lib/actions/add-calendar-to-calendarlist.d.ts +0 -7
- package/src/lib/actions/add-calendar-to-calendarlist.d.ts.map +0 -1
- package/src/lib/actions/add-calendar-to-calendarlist.js +0 -34
- package/src/lib/actions/add-calendar-to-calendarlist.js.map +0 -1
- package/src/lib/actions/create-event.d.ts +0 -25
- package/src/lib/actions/create-event.d.ts.map +0 -1
- package/src/lib/actions/create-event.js +0 -146
- package/src/lib/actions/create-event.js.map +0 -1
- package/src/lib/actions/create-quick-event.d.ts +0 -12
- package/src/lib/actions/create-quick-event.d.ts.map +0 -1
- package/src/lib/actions/create-quick-event.js +0 -66
- package/src/lib/actions/create-quick-event.js.map +0 -1
- package/src/lib/actions/delete-event.action.d.ts +0 -11
- package/src/lib/actions/delete-event.action.d.ts.map +0 -1
- package/src/lib/actions/delete-event.action.js +0 -34
- package/src/lib/actions/delete-event.action.js.map +0 -1
- package/src/lib/actions/find-busy-free-periods.d.ts +0 -12
- package/src/lib/actions/find-busy-free-periods.d.ts.map +0 -1
- package/src/lib/actions/find-busy-free-periods.js +0 -77
- package/src/lib/actions/find-busy-free-periods.js.map +0 -1
- package/src/lib/actions/get-event-by-id.d.ts +0 -13
- package/src/lib/actions/get-event-by-id.d.ts.map +0 -1
- package/src/lib/actions/get-event-by-id.js +0 -92
- package/src/lib/actions/get-event-by-id.js.map +0 -1
- package/src/lib/actions/get-events.d.ts +0 -15
- package/src/lib/actions/get-events.d.ts.map +0 -1
- package/src/lib/actions/get-events.js +0 -98
- package/src/lib/actions/get-events.js.map +0 -1
- package/src/lib/actions/update-event.action.d.ts +0 -24
- package/src/lib/actions/update-event.action.d.ts.map +0 -1
- package/src/lib/actions/update-event.action.js +0 -111
- package/src/lib/actions/update-event.action.js.map +0 -1
- package/src/lib/auth.d.ts +0 -11
- package/src/lib/auth.d.ts.map +0 -1
- package/src/lib/auth.js +0 -86
- package/src/lib/auth.js.map +0 -1
- package/src/lib/common/helper.d.ts +0 -26
- package/src/lib/common/helper.d.ts.map +0 -1
- package/src/lib/common/helper.js +0 -269
- package/src/lib/common/helper.js.map +0 -1
- package/src/lib/common/index.d.ts +0 -20
- package/src/lib/common/index.d.ts.map +0 -1
- package/src/lib/common/index.js +0 -99
- package/src/lib/common/index.js.map +0 -1
- package/src/lib/common/types.d.ts +0 -240
- package/src/lib/common/types.d.ts.map +0 -1
- package/src/lib/common/types.js +0 -17
- package/src/lib/common/types.js.map +0 -1
- package/src/lib/triggers/calendar-event.d.ts +0 -39
- package/src/lib/triggers/calendar-event.d.ts.map +0 -1
- package/src/lib/triggers/calendar-event.js +0 -144
- package/src/lib/triggers/calendar-event.js.map +0 -1
- package/src/lib/triggers/event-cancelled.d.ts +0 -71
- package/src/lib/triggers/event-cancelled.d.ts.map +0 -1
- package/src/lib/triggers/event-cancelled.js +0 -165
- package/src/lib/triggers/event-cancelled.js.map +0 -1
- package/src/lib/triggers/event-ends.d.ts +0 -67
- package/src/lib/triggers/event-ends.d.ts.map +0 -1
- package/src/lib/triggers/event-ends.js +0 -166
- package/src/lib/triggers/event-ends.js.map +0 -1
- package/src/lib/triggers/event-start-time-before.d.ts +0 -75
- package/src/lib/triggers/event-start-time-before.d.ts.map +0 -1
- package/src/lib/triggers/event-start-time-before.js +0 -160
- package/src/lib/triggers/event-start-time-before.js.map +0 -1
- package/src/lib/triggers/new-calendar.d.ts +0 -31
- package/src/lib/triggers/new-calendar.d.ts.map +0 -1
- package/src/lib/triggers/new-calendar.js +0 -151
- package/src/lib/triggers/new-calendar.js.map +0 -1
- package/src/lib/triggers/new-event-matching-search.d.ts +0 -47
- package/src/lib/triggers/new-event-matching-search.d.ts.map +0 -1
- package/src/lib/triggers/new-event-matching-search.js +0 -184
- package/src/lib/triggers/new-event-matching-search.js.map +0 -1
- package/src/lib/triggers/new-event.d.ts +0 -47
- package/src/lib/triggers/new-event.d.ts.map +0 -1
- package/src/lib/triggers/new-event.js +0 -225
- package/src/lib/triggers/new-event.js.map +0 -1
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getEventById = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
-
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
-
const common_1 = require("../common");
|
|
8
|
-
exports.getEventById = (0, pieces_framework_1.createAction)({
|
|
9
|
-
auth: common_1.googleCalendarAuth,
|
|
10
|
-
name: 'google_calendar_get_event_by_id',
|
|
11
|
-
displayName: 'Get Event by ID',
|
|
12
|
-
description: 'Fetch event details by its unique ID from Google Calendar.',
|
|
13
|
-
props: {
|
|
14
|
-
calendar_id: common_1.googleCalendarCommon.calendarDropdown(),
|
|
15
|
-
event_id: pieces_framework_1.Property.ShortText({
|
|
16
|
-
displayName: 'Event ID',
|
|
17
|
-
description: 'The unique ID of the event (e.g., "abc123def456"). You can find this in the event URL or from other calendar actions.',
|
|
18
|
-
required: true,
|
|
19
|
-
}),
|
|
20
|
-
max_attendees: pieces_framework_1.Property.Number({
|
|
21
|
-
displayName: 'Max Attendees',
|
|
22
|
-
description: 'Maximum number of attendees to include in the response. If there are more attendees, only the participant is returned.',
|
|
23
|
-
required: false,
|
|
24
|
-
}),
|
|
25
|
-
time_zone: pieces_framework_1.Property.ShortText({
|
|
26
|
-
displayName: 'Time Zone',
|
|
27
|
-
description: 'Time zone for the response (e.g., "America/New_York", "Europe/London"). Defaults to the calendar\'s time zone if not specified.',
|
|
28
|
-
required: false,
|
|
29
|
-
}),
|
|
30
|
-
},
|
|
31
|
-
run(context) {
|
|
32
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
33
|
-
var _a, _b, _c, _d;
|
|
34
|
-
const { calendar_id: calendarId, event_id: eventId, max_attendees: maxAttendees, time_zone: timeZone, } = context.propsValue;
|
|
35
|
-
const token = yield (0, common_1.getAccessToken)(context.auth);
|
|
36
|
-
if (!calendarId ||
|
|
37
|
-
typeof calendarId !== 'string' ||
|
|
38
|
-
calendarId.trim().length === 0) {
|
|
39
|
-
throw new Error('Calendar ID is required');
|
|
40
|
-
}
|
|
41
|
-
if (!eventId ||
|
|
42
|
-
typeof eventId !== 'string' ||
|
|
43
|
-
eventId.trim().length === 0) {
|
|
44
|
-
throw new Error('Event ID cannot be empty');
|
|
45
|
-
}
|
|
46
|
-
if (eventId.length < 5 || eventId.length > 1024) {
|
|
47
|
-
throw new Error('Event ID must be between 5 and 1024 characters');
|
|
48
|
-
}
|
|
49
|
-
const queryParams = {};
|
|
50
|
-
if (maxAttendees !== undefined && maxAttendees > 0) {
|
|
51
|
-
queryParams.maxAttendees = maxAttendees.toString();
|
|
52
|
-
}
|
|
53
|
-
if (timeZone &&
|
|
54
|
-
typeof timeZone === 'string' &&
|
|
55
|
-
timeZone.trim().length > 0) {
|
|
56
|
-
queryParams.timeZone = timeZone.trim();
|
|
57
|
-
}
|
|
58
|
-
const url = `${common_1.googleCalendarCommon.baseUrl}/calendars/${encodeURIComponent(calendarId.trim())}/events/${encodeURIComponent(eventId.trim())}`;
|
|
59
|
-
const request = {
|
|
60
|
-
method: pieces_common_1.HttpMethod.GET,
|
|
61
|
-
url: url,
|
|
62
|
-
queryParams: queryParams,
|
|
63
|
-
authentication: {
|
|
64
|
-
type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
|
|
65
|
-
token: token,
|
|
66
|
-
},
|
|
67
|
-
};
|
|
68
|
-
try {
|
|
69
|
-
const response = yield pieces_common_1.httpClient.sendRequest(request);
|
|
70
|
-
return response.body;
|
|
71
|
-
}
|
|
72
|
-
catch (error) {
|
|
73
|
-
if (((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) === 404) {
|
|
74
|
-
throw new Error(`Event with ID "${eventId}" not found in calendar "${calendarId}". Please verify the event ID and calendar selection.`);
|
|
75
|
-
}
|
|
76
|
-
else if (((_b = error.response) === null || _b === void 0 ? void 0 : _b.status) === 403) {
|
|
77
|
-
throw new Error(`Access denied to event "${eventId}" in calendar "${calendarId}". Please check your permissions.`);
|
|
78
|
-
}
|
|
79
|
-
else if (((_c = error.response) === null || _c === void 0 ? void 0 : _c.status) === 400) {
|
|
80
|
-
throw new Error(`Invalid request parameters. Please check the event ID format and other parameters.`);
|
|
81
|
-
}
|
|
82
|
-
else if (((_d = error.response) === null || _d === void 0 ? void 0 : _d.status) === 401) {
|
|
83
|
-
throw new Error('Authentication failed. Please reconnect your Google Calendar account.');
|
|
84
|
-
}
|
|
85
|
-
else {
|
|
86
|
-
throw new Error(`Failed to fetch event: ${error.message || 'Unknown error occurred'}`);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
},
|
|
91
|
-
});
|
|
92
|
-
//# sourceMappingURL=get-event-by-id.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-event-by-id.js","sourceRoot":"","sources":["../../../../src/lib/actions/get-event-by-id.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAKqC;AACrC,sCAAqF;AAGxE,QAAA,YAAY,GAAG,IAAA,+BAAY,EAAC;IACvC,IAAI,EAAE,2BAAkB;IACxB,IAAI,EAAE,iCAAiC;IACvC,WAAW,EAAE,iBAAiB;IAC9B,WAAW,EAAE,4DAA4D;IACzE,KAAK,EAAE;QACL,WAAW,EAAE,6BAAoB,CAAC,gBAAgB,EAAE;QACpD,QAAQ,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A,KAAK,CAAC,QAAQ,0CAAE,MAAM,MAAK,GAAG,EAAE,CAAC;oBAC1C,MAAM,IAAI,KAAK,CACb,oFAAoF,CACrF,CAAC;gBACJ,CAAC;qBAAM,IAAI,CAAA,MAAA,KAAK,CAAC,QAAQ,0CAAE,MAAM,MAAK,GAAG,EAAE,CAAC;oBAC1C,MAAM,IAAI,KAAK,CACb,uEAAuE,CACxE,CAAC;gBACJ,CAAC;qBAAM,CAAC;oBACN,MAAM,IAAI,KAAK,CACb,0BAA0B,KAAK,CAAC,OAAO,IAAI,wBAAwB,EAAE,CACtE,CAAC;gBACJ,CAAC;YACH,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export declare const getEvents: import("@activepieces/pieces-framework").IAction<(import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
-
serviceAccount: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
-
userEmail: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
4
|
-
}>)[], {
|
|
5
|
-
calendar_id: import("@activepieces/pieces-framework").DropdownProperty<string, true, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
6
|
-
serviceAccount: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
7
|
-
userEmail: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
8
|
-
}>)[]>;
|
|
9
|
-
event_types: import("@activepieces/pieces-framework").StaticMultiSelectDropdownProperty<string, true>;
|
|
10
|
-
search: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
11
|
-
start_date: import("@activepieces/pieces-framework").DateTimeProperty<false>;
|
|
12
|
-
end_date: import("@activepieces/pieces-framework").DateTimeProperty<false>;
|
|
13
|
-
singleEvents: import("@activepieces/pieces-framework").CheckboxProperty<true>;
|
|
14
|
-
}>;
|
|
15
|
-
//# sourceMappingURL=get-events.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-events.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/get-events.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,SAAS;;;;;;;;;;;;;EAoGpB,CAAC"}
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getEvents = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
-
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
-
const common_1 = require("../common");
|
|
8
|
-
const dayjs_1 = tslib_1.__importDefault(require("dayjs"));
|
|
9
|
-
exports.getEvents = (0, pieces_framework_1.createAction)({
|
|
10
|
-
auth: common_1.googleCalendarAuth,
|
|
11
|
-
name: 'google_calendar_get_events',
|
|
12
|
-
description: 'Get Events',
|
|
13
|
-
displayName: 'Get all Events',
|
|
14
|
-
props: {
|
|
15
|
-
calendar_id: common_1.googleCalendarCommon.calendarDropdown('writer'),
|
|
16
|
-
event_types: pieces_framework_1.Property.StaticMultiSelectDropdown({
|
|
17
|
-
displayName: 'Event types',
|
|
18
|
-
description: 'Select event types',
|
|
19
|
-
required: true,
|
|
20
|
-
defaultValue: ['default', 'focusTime', 'outOfOffice'],
|
|
21
|
-
options: {
|
|
22
|
-
options: [
|
|
23
|
-
{
|
|
24
|
-
label: 'Default',
|
|
25
|
-
value: 'default',
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
label: 'Out Of Office',
|
|
29
|
-
value: 'outOfOffice',
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
label: 'Focus Time',
|
|
33
|
-
value: 'focusTime',
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
label: 'Working Location',
|
|
37
|
-
value: 'workingLocation',
|
|
38
|
-
},
|
|
39
|
-
],
|
|
40
|
-
},
|
|
41
|
-
}),
|
|
42
|
-
search: pieces_framework_1.Property.ShortText({
|
|
43
|
-
displayName: 'Search Term',
|
|
44
|
-
required: false,
|
|
45
|
-
}),
|
|
46
|
-
start_date: pieces_framework_1.Property.DateTime({
|
|
47
|
-
displayName: 'Date from',
|
|
48
|
-
required: false,
|
|
49
|
-
}),
|
|
50
|
-
end_date: pieces_framework_1.Property.DateTime({
|
|
51
|
-
displayName: 'Date to',
|
|
52
|
-
required: false,
|
|
53
|
-
}),
|
|
54
|
-
singleEvents: pieces_framework_1.Property.Checkbox({
|
|
55
|
-
displayName: 'Expand Recurring Event?',
|
|
56
|
-
description: "Whether to expand recurring events into instances and only return single one-off events and instances of recurring events, but not the underlying recurring events themselves.",
|
|
57
|
-
required: true,
|
|
58
|
-
defaultValue: false,
|
|
59
|
-
}),
|
|
60
|
-
},
|
|
61
|
-
run(configValue) {
|
|
62
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
63
|
-
// docs: https://developers.google.com/calendar/api/v3/reference/events/list
|
|
64
|
-
const { calendar_id: calendarId, start_date, end_date, search, event_types, singleEvents, } = configValue.propsValue;
|
|
65
|
-
const token = yield (0, common_1.getAccessToken)(configValue.auth);
|
|
66
|
-
const queryParams = { showDeleted: 'false' };
|
|
67
|
-
let url = `${common_1.googleCalendarCommon.baseUrl}/calendars/${calendarId}/events`;
|
|
68
|
-
if (singleEvents !== null) {
|
|
69
|
-
queryParams['singleEvents'] = singleEvents ? 'true' : 'false';
|
|
70
|
-
}
|
|
71
|
-
if (search) {
|
|
72
|
-
queryParams['q'] = `"${search}"`;
|
|
73
|
-
}
|
|
74
|
-
// date range
|
|
75
|
-
if (start_date) {
|
|
76
|
-
queryParams['timeMin'] = (0, dayjs_1.default)(start_date).format('YYYY-MM-DDTHH:mm:ss.sssZ');
|
|
77
|
-
}
|
|
78
|
-
if (start_date && end_date) {
|
|
79
|
-
queryParams['timeMax'] = (0, dayjs_1.default)(end_date).format('YYYY-MM-DDTHH:mm:ss.sssZ');
|
|
80
|
-
}
|
|
81
|
-
// filter by event type
|
|
82
|
-
if (event_types.length > 0) {
|
|
83
|
-
url += `?${event_types.map((type) => `eventTypes=${type}`).join('&')}`;
|
|
84
|
-
}
|
|
85
|
-
const request = {
|
|
86
|
-
method: pieces_common_1.HttpMethod.GET,
|
|
87
|
-
url,
|
|
88
|
-
queryParams,
|
|
89
|
-
authentication: {
|
|
90
|
-
type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
|
|
91
|
-
token,
|
|
92
|
-
},
|
|
93
|
-
};
|
|
94
|
-
return yield pieces_common_1.httpClient.sendRequest(request);
|
|
95
|
-
});
|
|
96
|
-
},
|
|
97
|
-
});
|
|
98
|
-
//# sourceMappingURL=get-events.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-events.js","sourceRoot":"","sources":["../../../../src/lib/actions/get-events.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAKqC;AACrC,sCAAqF;AACrF,0DAA0B;AAEb,QAAA,SAAS,GAAG,IAAA,+BAAY,EAAC;IACpC,IAAI,EAAE,2BAAkB;IACxB,IAAI,EAAE,4BAA4B;IAClC,WAAW,EAAE,YAAY;IACzB,WAAW,EAAE,gBAAgB;IAC7B,KAAK,EAAE;QACL,WAAW,EAAE,6BAAoB,CAAC,gBAAgB,CAAC,QAAQ,CAAC;QAC5D,WAAW,EAAE,2BAAQ,CAAC,yBAAyB,CAAC;YAC9C,WAAW,EAAE,aAAa;YAC1B,WAAW,EAAE,oBAAoB;YACjC,QAAQ,EAAE,IAAI;YACd,YAAY,EAAE,CAAC,SAAS,EAAE,WAAW,EAAE,aAAa,CAAC;YACrD,OAAO,EAAE;gBACP,OAAO,EAAE;oBACP;wBACE,KAAK,EAAE,SAAS;wBAChB,KAAK,EAAE,SAAS;qBACjB;oBACD;w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IAAI,MAAM,EAAE,CAAC;gBACX,WAAW,CAAC,GAAG,CAAC,GAAG,IAAI,MAAM,GAAG,CAAC;YACnC,CAAC;YAED,aAAa;YACb,IAAI,UAAU,EAAE,CAAC;gBACf,WAAW,CAAC,SAAS,CAAC,GAAG,IAAA,eAAK,EAAC,UAAU,CAAC,CAAC,MAAM,CAC/C,0BAA0B,CAC3B,CAAC;YACJ,CAAC;YACD,IAAI,UAAU,IAAI,QAAQ,EAAE,CAAC;gBAC3B,WAAW,CAAC,SAAS,CAAC,GAAG,IAAA,eAAK,EAAC,QAAQ,CAAC,CAAC,MAAM,CAC7C,0BAA0B,CAC3B,CAAC;YACJ,CAAC;YACD,uBAAuB;YACvB,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC3B,GAAG,IAAI,IAAI,WAAW,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,cAAc,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;YACzE,CAAC;YACD,MAAM,OAAO,GAAyC;gBACpD,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,GAAG;gBACH,WAAW;gBACX,cAAc,EAAE;oBACd,IAAI,EAAE,kCAAkB,CAAC,YAAY;oBACrC,KAAK;iBACN;aACF,CAAC;YACF,OAAO,MAAM,0BAAU,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QAC/C,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export declare const updateEventAction: import("@activepieces/pieces-framework").IAction<(import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
-
serviceAccount: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
-
userEmail: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
4
|
-
}>)[], {
|
|
5
|
-
calendar_id: import("@activepieces/pieces-framework").DropdownProperty<string, true, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
6
|
-
serviceAccount: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
7
|
-
userEmail: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
8
|
-
}>)[]>;
|
|
9
|
-
eventId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
10
|
-
title: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
11
|
-
start_date_time: import("@activepieces/pieces-framework").DateTimeProperty<false>;
|
|
12
|
-
end_date_time: import("@activepieces/pieces-framework").DateTimeProperty<false>;
|
|
13
|
-
location: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
14
|
-
description: import("@activepieces/pieces-framework").LongTextProperty<false>;
|
|
15
|
-
colorId: import("@activepieces/pieces-framework").DropdownProperty<string, false, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
16
|
-
serviceAccount: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
17
|
-
userEmail: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
18
|
-
}>)[]>;
|
|
19
|
-
attendees: import("@activepieces/pieces-framework").ArrayProperty<false>;
|
|
20
|
-
guests_can_modify: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
21
|
-
guests_can_invite_others: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
22
|
-
guests_can_see_other_guests: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
23
|
-
}>;
|
|
24
|
-
//# sourceMappingURL=update-event.action.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"update-event.action.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/update-event.action.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;EAwH5B,CAAC"}
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.updateEventAction = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
-
const googleapis_1 = require("googleapis");
|
|
7
|
-
const common_1 = require("../common");
|
|
8
|
-
const dayjs_1 = tslib_1.__importDefault(require("dayjs"));
|
|
9
|
-
exports.updateEventAction = (0, pieces_framework_1.createAction)({
|
|
10
|
-
displayName: 'Update Event',
|
|
11
|
-
auth: common_1.googleCalendarAuth,
|
|
12
|
-
name: 'update_event',
|
|
13
|
-
description: 'Updates an event in Google Calendar.',
|
|
14
|
-
props: {
|
|
15
|
-
calendar_id: common_1.googleCalendarCommon.calendarDropdown('writer'),
|
|
16
|
-
eventId: pieces_framework_1.Property.ShortText({
|
|
17
|
-
displayName: 'Event ID',
|
|
18
|
-
required: true,
|
|
19
|
-
}),
|
|
20
|
-
title: pieces_framework_1.Property.ShortText({
|
|
21
|
-
displayName: 'Title of the event',
|
|
22
|
-
required: false,
|
|
23
|
-
}),
|
|
24
|
-
start_date_time: pieces_framework_1.Property.DateTime({
|
|
25
|
-
displayName: 'Start date time of the event',
|
|
26
|
-
required: false,
|
|
27
|
-
}),
|
|
28
|
-
end_date_time: pieces_framework_1.Property.DateTime({
|
|
29
|
-
displayName: 'End date time of the event',
|
|
30
|
-
required: false,
|
|
31
|
-
}),
|
|
32
|
-
location: pieces_framework_1.Property.ShortText({
|
|
33
|
-
displayName: 'Location',
|
|
34
|
-
required: false,
|
|
35
|
-
}),
|
|
36
|
-
description: pieces_framework_1.Property.LongText({
|
|
37
|
-
displayName: 'Description',
|
|
38
|
-
description: 'Description of the event. You can use HTML tags here.',
|
|
39
|
-
required: false,
|
|
40
|
-
}),
|
|
41
|
-
colorId: common_1.googleCalendarCommon.colorId,
|
|
42
|
-
attendees: pieces_framework_1.Property.Array({
|
|
43
|
-
displayName: 'Attendees',
|
|
44
|
-
description: 'Emails of the attendees (guests)',
|
|
45
|
-
required: false,
|
|
46
|
-
}),
|
|
47
|
-
guests_can_modify: pieces_framework_1.Property.Checkbox({
|
|
48
|
-
displayName: 'Guests can modify',
|
|
49
|
-
defaultValue: false,
|
|
50
|
-
required: false,
|
|
51
|
-
}),
|
|
52
|
-
guests_can_invite_others: pieces_framework_1.Property.Checkbox({
|
|
53
|
-
displayName: 'Guests can invite others',
|
|
54
|
-
defaultValue: false,
|
|
55
|
-
required: false,
|
|
56
|
-
}),
|
|
57
|
-
guests_can_see_other_guests: pieces_framework_1.Property.Checkbox({
|
|
58
|
-
displayName: 'Guests can see other guests',
|
|
59
|
-
defaultValue: false,
|
|
60
|
-
required: false,
|
|
61
|
-
}),
|
|
62
|
-
},
|
|
63
|
-
run(context) {
|
|
64
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
65
|
-
const { calendar_id, eventId, title, start_date_time, end_date_time, location, description, colorId, guests_can_invite_others, guests_can_modify, guests_can_see_other_guests, } = context.propsValue;
|
|
66
|
-
const attendees = context.propsValue.attendees;
|
|
67
|
-
const authClient = yield (0, common_1.createGoogleClient)(context.auth);
|
|
68
|
-
const calendar = googleapis_1.google.calendar({ version: 'v3', auth: authClient });
|
|
69
|
-
// Note that each patch request consumes three quota units;
|
|
70
|
-
// prefer using a get followed by an update
|
|
71
|
-
const currentEvent = yield calendar.events.get({
|
|
72
|
-
calendarId: calendar_id,
|
|
73
|
-
eventId: eventId,
|
|
74
|
-
});
|
|
75
|
-
let attendeeFormattedList = [];
|
|
76
|
-
if (Array.isArray(attendees) && attendees.length > 0) {
|
|
77
|
-
attendeeFormattedList = attendees.map((email) => ({ email }));
|
|
78
|
-
}
|
|
79
|
-
else if (currentEvent.data.attendees &&
|
|
80
|
-
Array.isArray(currentEvent.data.attendees)) {
|
|
81
|
-
attendeeFormattedList = currentEvent.data.attendees;
|
|
82
|
-
}
|
|
83
|
-
const response = yield calendar.events.update({
|
|
84
|
-
calendarId: calendar_id,
|
|
85
|
-
eventId: eventId,
|
|
86
|
-
requestBody: {
|
|
87
|
-
summary: title !== null && title !== void 0 ? title : currentEvent.data.summary,
|
|
88
|
-
attendees: attendeeFormattedList,
|
|
89
|
-
description: description !== null && description !== void 0 ? description : currentEvent.data.description,
|
|
90
|
-
colorId: colorId,
|
|
91
|
-
location: location !== null && location !== void 0 ? location : currentEvent.data.location,
|
|
92
|
-
start: start_date_time
|
|
93
|
-
? {
|
|
94
|
-
dateTime: (0, dayjs_1.default)(start_date_time).format('YYYY-MM-DDTHH:mm:ss.sssZ'),
|
|
95
|
-
}
|
|
96
|
-
: currentEvent.data.start,
|
|
97
|
-
end: end_date_time
|
|
98
|
-
? {
|
|
99
|
-
dateTime: (0, dayjs_1.default)(end_date_time).format('YYYY-MM-DDTHH:mm:ss.sssZ'),
|
|
100
|
-
}
|
|
101
|
-
: currentEvent.data.end,
|
|
102
|
-
guestsCanInviteOthers: guests_can_invite_others,
|
|
103
|
-
guestsCanModify: guests_can_modify,
|
|
104
|
-
guestsCanSeeOtherGuests: guests_can_see_other_guests,
|
|
105
|
-
},
|
|
106
|
-
});
|
|
107
|
-
return response.data;
|
|
108
|
-
});
|
|
109
|
-
},
|
|
110
|
-
});
|
|
111
|
-
//# sourceMappingURL=update-event.action.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"update-event.action.js","sourceRoot":"","sources":["../../../../src/lib/actions/update-event.action.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,2CAAiD;AACjD,sCAAyF;AACzF,0DAA0B;AAEb,QAAA,iBAAiB,GAAG,IAAA,+BAAY,EAAC;IAC5C,WAAW,EAAE,cAAc;IAC3B,IAAI,EAAE,2BAAkB;IACxB,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,sCAAsC;IACnD,KAAK,EAAE;QAC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,MAAM,CAAC;gBAC5C,UAAU,EAAE,WAAW;gBACvB,OAAO,EAAE,OAAO;gBAChB,WAAW,EAAE;oBACX,OAAO,EAAE,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,YAAY,CAAC,IAAI,CAAC,OAAO;oBAC3C,SAAS,EAAE,qBAAqB;oBAChC,WAAW,EAAE,WAAW,aAAX,WAAW,cAAX,WAAW,GAAI,YAAY,CAAC,IAAI,CAAC,WAAW;oBACzD,OAAO,EAAE,OAAO;oBAChB,QAAQ,EAAE,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,YAAY,CAAC,IAAI,CAAC,QAAQ;oBAChD,KAAK,EAAE,eAAe;wBACpB,CAAC,CAAC;4BACE,QAAQ,EAAE,IAAA,eAAK,EAAC,eAAe,CAAC,CAAC,MAAM,CACrC,0BAA0B,CAC3B;yBACF;wBACH,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK;oBAC3B,GAAG,EAAE,aAAa;wBAChB,CAAC,CAAC;4BACE,QAAQ,EAAE,IAAA,eAAK,EAAC,aAAa,CAAC,CAAC,MAAM,CAAC,0BAA0B,CAAC;yBAClE;wBACH,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG;oBACzB,qBAAqB,EAAE,wBAAwB;oBAC/C,eAAe,EAAE,iBAAiB;oBAClC,uBAAuB,EAAE,2BAA2B;iBACrD;aACF,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
package/src/lib/auth.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { AppConnectionValueForAuthProperty } from '@activepieces/pieces-framework';
|
|
2
|
-
import { OAuth2Client } from 'googleapis-common';
|
|
3
|
-
export declare const googleCalendarScopes: string[];
|
|
4
|
-
export declare const googleCalendarAuth: (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
5
|
-
serviceAccount: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
6
|
-
userEmail: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
7
|
-
}>)[];
|
|
8
|
-
export type GoogleCalendarAuthValue = AppConnectionValueForAuthProperty<typeof googleCalendarAuth>;
|
|
9
|
-
export declare function createGoogleClient(auth: GoogleCalendarAuthValue): Promise<OAuth2Client>;
|
|
10
|
-
export declare const getAccessToken: (auth: GoogleCalendarAuthValue) => Promise<string>;
|
|
11
|
-
//# sourceMappingURL=auth.d.ts.map
|
package/src/lib/auth.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/lib/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iCAAiC,EAAuB,MAAM,gCAAgC,CAAC;AAGxG,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,eAAO,MAAM,oBAAoB,UAKhC,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;KAsC5B,CAAC;AAEJ,MAAM,MAAM,uBAAuB,GAAG,iCAAiC,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAEnG,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,uBAAuB,GAAG,OAAO,CAAC,YAAY,CAAC,CAa7F;AAED,eAAO,MAAM,cAAc,SAAgB,uBAAuB,KAAG,OAAO,CAAC,MAAM,CAWlF,CAAC"}
|
package/src/lib/auth.js
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getAccessToken = exports.googleCalendarAuth = exports.googleCalendarScopes = void 0;
|
|
4
|
-
exports.createGoogleClient = createGoogleClient;
|
|
5
|
-
const tslib_1 = require("tslib");
|
|
6
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
7
|
-
const shared_1 = require("@activepieces/shared");
|
|
8
|
-
const googleapis_1 = require("googleapis");
|
|
9
|
-
const googleapis_common_1 = require("googleapis-common");
|
|
10
|
-
exports.googleCalendarScopes = [
|
|
11
|
-
'https://www.googleapis.com/auth/calendar.events',
|
|
12
|
-
'https://www.googleapis.com/auth/calendar.readonly',
|
|
13
|
-
// TODO: Add the scope after Google App Verification
|
|
14
|
-
// 'https://www.googleapis.com/auth/calendar.calendarlist'
|
|
15
|
-
];
|
|
16
|
-
exports.googleCalendarAuth = [pieces_framework_1.PieceAuth.OAuth2({
|
|
17
|
-
description: '',
|
|
18
|
-
authUrl: 'https://accounts.google.com/o/oauth2/auth',
|
|
19
|
-
tokenUrl: 'https://oauth2.googleapis.com/token',
|
|
20
|
-
required: true,
|
|
21
|
-
pkce: true,
|
|
22
|
-
scope: exports.googleCalendarScopes,
|
|
23
|
-
}), pieces_framework_1.PieceAuth.CustomAuth({
|
|
24
|
-
displayName: 'Service Account (Advanced)',
|
|
25
|
-
description: 'Authenticate via service account from https://console.cloud.google.com/ > IAM & Admin > Service Accounts > Create Service Account > Keys > Add key. <br> <br> You can optionally use domain-wide delegation (https://support.google.com/a/answer/162106?hl=en#zippy=%2Cset-up-domain-wide-delegation-for-a-client) to access calendars without adding the service account to each one. <br> <br> **Note:** Without a user email, the service account only has access to calendars you explicitly share with it.',
|
|
26
|
-
required: true,
|
|
27
|
-
props: {
|
|
28
|
-
serviceAccount: pieces_framework_1.Property.ShortText({
|
|
29
|
-
displayName: 'Service Account JSON Key',
|
|
30
|
-
required: true,
|
|
31
|
-
}),
|
|
32
|
-
userEmail: pieces_framework_1.Property.ShortText({
|
|
33
|
-
displayName: 'User Email',
|
|
34
|
-
required: false,
|
|
35
|
-
description: 'Email address of the user to impersonate for domain-wide delegation.',
|
|
36
|
-
}),
|
|
37
|
-
},
|
|
38
|
-
validate: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
39
|
-
try {
|
|
40
|
-
yield (0, exports.getAccessToken)({
|
|
41
|
-
type: shared_1.AppConnectionType.CUSTOM_AUTH,
|
|
42
|
-
props: Object.assign({}, auth),
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
catch (e) {
|
|
46
|
-
return {
|
|
47
|
-
valid: false,
|
|
48
|
-
error: e.message,
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
return {
|
|
52
|
-
valid: true,
|
|
53
|
-
};
|
|
54
|
-
}),
|
|
55
|
-
})];
|
|
56
|
-
function createGoogleClient(auth) {
|
|
57
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
58
|
-
if (auth.type === shared_1.AppConnectionType.CUSTOM_AUTH) {
|
|
59
|
-
const serviceAccount = JSON.parse(auth.props.serviceAccount);
|
|
60
|
-
return new googleapis_1.google.auth.JWT({
|
|
61
|
-
email: serviceAccount.client_email,
|
|
62
|
-
key: serviceAccount.private_key,
|
|
63
|
-
scopes: exports.googleCalendarScopes,
|
|
64
|
-
subject: auth.props.userEmail,
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
const authClient = new googleapis_common_1.OAuth2Client();
|
|
68
|
-
authClient.setCredentials(auth);
|
|
69
|
-
return authClient;
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
const getAccessToken = (auth) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
73
|
-
if (auth.type === shared_1.AppConnectionType.CUSTOM_AUTH) {
|
|
74
|
-
const googleClient = yield createGoogleClient(auth);
|
|
75
|
-
const response = yield googleClient.getAccessToken();
|
|
76
|
-
if (response.token) {
|
|
77
|
-
return response.token;
|
|
78
|
-
}
|
|
79
|
-
else {
|
|
80
|
-
throw new Error('Could not retrieve access token from service account json');
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
return auth.access_token;
|
|
84
|
-
});
|
|
85
|
-
exports.getAccessToken = getAccessToken;
|
|
86
|
-
//# sourceMappingURL=auth.js.map
|
package/src/lib/auth.js.map
DELETED
|
@@ -1 +0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alendarObject, GoogleCalendarEvent, GetColorsResponse } from './types';
|
|
3
|
-
export declare function stopWatchEvent(body: GoogleWatchResponse, authProp: GoogleCalendarAuthValue): Promise<void>;
|
|
4
|
-
export declare function watchEvent(calendarId: string, webhookUrl: string, authProp: GoogleCalendarAuthValue): Promise<GoogleWatchResponse>;
|
|
5
|
-
export declare function getInitialSyncToken({ calendarId, authProp, }: {
|
|
6
|
-
calendarId: string;
|
|
7
|
-
authProp: GoogleCalendarAuthValue;
|
|
8
|
-
}): Promise<string | undefined>;
|
|
9
|
-
export declare function listEventsWithSyncToken({ calendarId, syncToken, authProp, }: {
|
|
10
|
-
calendarId: string;
|
|
11
|
-
syncToken: string;
|
|
12
|
-
authProp: GoogleCalendarAuthValue;
|
|
13
|
-
}): Promise<{
|
|
14
|
-
items: GoogleCalendarEvent[];
|
|
15
|
-
nextSyncToken: string | undefined;
|
|
16
|
-
syncTokenInvalid: boolean;
|
|
17
|
-
}>;
|
|
18
|
-
export declare function getCalendars(authProp: GoogleCalendarAuthValue, minAccessRole?: 'writer'): Promise<CalendarObject[]>;
|
|
19
|
-
export declare function getColors(authProp: GoogleCalendarAuthValue): Promise<GetColorsResponse>;
|
|
20
|
-
export declare function getEvents(calendarId: string, expandRecurringEvent: boolean, authProp: GoogleCalendarAuthValue, minUpdated?: Date): Promise<GoogleCalendarEvent[]>;
|
|
21
|
-
export declare function getLatestEvent(calendarId: string, authProp: GoogleCalendarAuthValue): Promise<GoogleCalendarEvent>;
|
|
22
|
-
export declare function getEventsForDropdown(authProp: GoogleCalendarAuthValue, calendarId?: string, maxResults?: number): Promise<{
|
|
23
|
-
label: string;
|
|
24
|
-
value: string;
|
|
25
|
-
}[]>;
|
|
26
|
-
//# sourceMappingURL=helper.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helper.d.ts","sourceRoot":"","sources":["../../../../src/lib/common/helper.ts"],"names":[],"mappings":"AAOA,OAAO,EAAwB,uBAAuB,EAAkB,M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