@activepieces/piece-google-calendar 0.3.1 → 0.3.2
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@activepieces/piece-google-calendar",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@sinclair/typebox": "0.26.8",
|
|
6
6
|
"axios": "^1.6.0",
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
"semver": "7.5.4",
|
|
12
12
|
"@activepieces/pieces-common": "0.2.5",
|
|
13
13
|
"@activepieces/pieces-framework": "0.7.1",
|
|
14
|
-
"@activepieces/shared": "0.10.
|
|
15
|
-
"tslib": "2.6.
|
|
14
|
+
"@activepieces/shared": "0.10.23",
|
|
15
|
+
"tslib": "2.6.1"
|
|
16
16
|
},
|
|
17
17
|
"main": "./src/index.js",
|
|
18
18
|
"type": "commonjs"
|
package/src/index.js
CHANGED
|
@@ -5,6 +5,7 @@ const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
|
5
5
|
const create_quick_event_1 = require("./lib/actions/create-quick-event");
|
|
6
6
|
const calendar_event_1 = require("./lib/triggers/calendar-event");
|
|
7
7
|
const create_event_1 = require("./lib/actions/create-event");
|
|
8
|
+
const get_events_1 = require("./lib/actions/get-events");
|
|
8
9
|
exports.googleCalendarAuth = pieces_framework_1.PieceAuth.OAuth2({
|
|
9
10
|
description: '',
|
|
10
11
|
authUrl: 'https://accounts.google.com/o/oauth2/auth',
|
|
@@ -19,7 +20,7 @@ exports.googleCalendar = (0, pieces_framework_1.createPiece)({
|
|
|
19
20
|
displayName: 'Google Calendar',
|
|
20
21
|
authors: ['osamahaikal', 'bibhuty-did-this', 'MoShizzle'],
|
|
21
22
|
auth: exports.googleCalendarAuth,
|
|
22
|
-
actions: [create_quick_event_1.createQuickCalendarEvent, create_event_1.createEvent],
|
|
23
|
+
actions: [create_quick_event_1.createQuickCalendarEvent, create_event_1.createEvent, get_events_1.getEvents],
|
|
23
24
|
triggers: [calendar_event_1.calendarEventChanged],
|
|
24
25
|
});
|
|
25
26
|
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/pieces/google-calendar/src/index.ts"],"names":[],"mappings":";;;AAAA,qEAAwE;AACxE,yEAA4E;AAC5E,kEAAqE;AACrE,6DAAyD;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/pieces/google-calendar/src/index.ts"],"names":[],"mappings":";;;AAAA,qEAAwE;AACxE,yEAA4E;AAC5E,kEAAqE;AACrE,6DAAyD;AACzD,yDAAqD;AAExC,QAAA,kBAAkB,GAAG,4BAAS,CAAC,MAAM,CAAC;IAC/C,WAAW,EAAE,EAAE;IACf,OAAO,EAAE,2CAA2C;IACpD,QAAQ,EAAE,qCAAqC;IAC/C,QAAQ,EAAE,IAAI;IACd,IAAI,EAAE,IAAI;IACV,KAAK,EAAE,CAAC,iDAAiD,EAAE,mDAAmD,CAAC;CAClH,CAAC,CAAC;AAEU,QAAA,cAAc,GAAG,IAAA,8BAAW,EAAC;IACtC,uBAAuB,EAAE,OAAO;IAChC,OAAO,EAAE,yDAAyD;IAClE,WAAW,EAAE,iBAAiB;IAC9B,OAAO,EAAE,CAAC,aAAa,EAAE,kBAAkB,EAAE,WAAW,CAAC;IACzD,IAAI,EAAE,0BAAkB;IACxB,OAAO,EAAE,CAAC,6CAAwB,EAAE,0BAAW,EAAE,sBAAS,CAAC;IAC3D,QAAQ,EAAE,CAAC,qCAAoB,CAAC;CACnC,CAAC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const getEvents: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").OAuth2Property<true, import("@activepieces/pieces-framework").OAuth2Props>, {
|
|
2
|
+
calendar_id: import("@activepieces/pieces-framework").DropdownProperty<string, false> | import("@activepieces/pieces-framework").DropdownProperty<string, true>;
|
|
3
|
+
event_types: import("@activepieces/pieces-framework").StaticMultiSelectDropdownProperty<string, true>;
|
|
4
|
+
start_date: import("@activepieces/pieces-framework").DateTimeProperty<false>;
|
|
5
|
+
end_date: import("@activepieces/pieces-framework").DateTimeProperty<false>;
|
|
6
|
+
}>;
|
|
@@ -0,0 +1,83 @@
|
|
|
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
|
+
const __1 = require("../../");
|
|
10
|
+
exports.getEvents = (0, pieces_framework_1.createAction)({
|
|
11
|
+
auth: __1.googleCalendarAuth,
|
|
12
|
+
name: 'google_calendar_get_events',
|
|
13
|
+
description: 'Get Events',
|
|
14
|
+
displayName: 'Get all Events',
|
|
15
|
+
props: {
|
|
16
|
+
calendar_id: common_1.googleCalendarCommon.calendarDropdown('writer'),
|
|
17
|
+
event_types: pieces_framework_1.Property.StaticMultiSelectDropdown({
|
|
18
|
+
displayName: 'Event types',
|
|
19
|
+
description: 'Select event types',
|
|
20
|
+
required: true,
|
|
21
|
+
defaultValue: ["default", "focusTime", "outOfOffice"],
|
|
22
|
+
options: {
|
|
23
|
+
options: [
|
|
24
|
+
{
|
|
25
|
+
label: 'Default',
|
|
26
|
+
value: 'default'
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
label: 'Out Of Office',
|
|
30
|
+
value: 'outOfOffice'
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
label: 'Focus Time',
|
|
34
|
+
value: 'focusTime'
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
label: 'Working Location',
|
|
38
|
+
value: 'workingLocation'
|
|
39
|
+
}
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
|
+
}),
|
|
43
|
+
start_date: pieces_framework_1.Property.DateTime({
|
|
44
|
+
displayName: 'Date from',
|
|
45
|
+
required: false,
|
|
46
|
+
}),
|
|
47
|
+
end_date: pieces_framework_1.Property.DateTime({
|
|
48
|
+
displayName: 'Date to',
|
|
49
|
+
required: false,
|
|
50
|
+
})
|
|
51
|
+
},
|
|
52
|
+
run(configValue) {
|
|
53
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
54
|
+
// docs: https://developers.google.com/calendar/api/v3/reference/events/list
|
|
55
|
+
const { calendar_id: calendarId, start_date, end_date, event_types } = configValue.propsValue;
|
|
56
|
+
const { access_token: token } = configValue.auth;
|
|
57
|
+
const queryParams = { showDeleted: "false" };
|
|
58
|
+
let url = `${common_1.googleCalendarCommon.baseUrl}/calendars/${calendarId}/events`;
|
|
59
|
+
// date range
|
|
60
|
+
if (start_date) {
|
|
61
|
+
queryParams['timeMin'] = (0, dayjs_1.default)(start_date).format('YYYY-MM-DDTHH:mm:ss.sssZ');
|
|
62
|
+
}
|
|
63
|
+
if (start_date && end_date) {
|
|
64
|
+
queryParams['timeMax'] = (0, dayjs_1.default)(end_date).format('YYYY-MM-DDTHH:mm:ss.sssZ');
|
|
65
|
+
}
|
|
66
|
+
// filter by event type
|
|
67
|
+
if (event_types.length > 0) {
|
|
68
|
+
url += `?${event_types.map(type => `eventTypes=${type}`).join("&")}`;
|
|
69
|
+
}
|
|
70
|
+
const request = {
|
|
71
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
72
|
+
url,
|
|
73
|
+
queryParams,
|
|
74
|
+
authentication: {
|
|
75
|
+
type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
|
|
76
|
+
token,
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
return yield pieces_common_1.httpClient.sendRequest(request);
|
|
80
|
+
});
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
//# sourceMappingURL=get-events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-events.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/google-calendar/src/lib/actions/get-events.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAsG;AACtG,sCAAiD;AACjD,0DAA0B;AAC1B,8BAA4C;AAE/B,QAAA,SAAS,GAAG,IAAA,+BAAY,EAAC;IAClC,IAAI,EAAE,sBAAkB;IACxB,IAAI,EAAE,4BAA4B;IAClC,WAAW,EAAE,YAAY;IACzB,WAAW,EAAE,gBAAgB;IAC7B,KAAK,EAAE;QACH,WAAW,EAAE,6BAAoB,CAAC,gBAAgB,CAAC,QAAQ,CAAC;QAC5D,WAAW,EAAE,2BAAQ,CAAC,yBAAyB,CAAC;YAC5C,WAAW,EAAE,aAAa;YAC1B,WAAW,EAAE,oBAAoB;YACjC,QAAQ,EAAE,IAAI;YACd,YAAY,EAAE,CAAC,SAAS,EAAE,WAAW,EAAE,aAAa,CAAC;YACrD,OAAO,EAAE;gBACL,OAAO,EAAE;oBACL;wBACI,KAAK,EAAE,SAAS;wBAChB,KAAK,EAAE,SAAS;qBACnB;oBACD;wBACI,KAAK,EAAE,eAAe;wBACtB,KAAK,EAAE,aAAa;qBACvB;oBACD;wBACI,KAAK,EAAE,YAAY;wBACnB,KAAK,EAAE,WAAW;qBACrB;oBACD;wBACI,KAAK,EAAE,kBAAkB;wBACzB,KAAK,EAAE,iBAAiB;qBAC3B;iBACJ;aACJ;SACJ,CAAC;QACF,UAAU,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YAC1B,WAAW,EAAE,WAAW;YACxB,QAAQ,EAAE,KAAK;SAClB,CAAC;QACF,QAAQ,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACxB,WAAW,EAAE,SAA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