@activepieces/piece-google-calendar 0.9.3 → 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 -53
- 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 -148
- 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 -68
- 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 -36
- 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 -79
- 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 -94
- 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 -100
- 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 -113
- 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 -147
- 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 -168
- 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 -169
- 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 -163
- 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 -154
- 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 -187
- 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 -228
- package/src/lib/triggers/new-event.js.map +0 -1
|
@@ -1,94 +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
|
-
audience: 'both',
|
|
14
|
-
aiMetadata: { description: 'Fetches the full details of a single Google Calendar event by its unique event ID within a given calendar. Use when you already have an event ID (e.g. from a trigger or a list action) and need its details; use Get all Events to search when you do not. Requires a valid event ID. Read-only and idempotent.', idempotent: true },
|
|
15
|
-
props: {
|
|
16
|
-
calendar_id: common_1.googleCalendarCommon.calendarDropdown(),
|
|
17
|
-
event_id: pieces_framework_1.Property.ShortText({
|
|
18
|
-
displayName: 'Event ID',
|
|
19
|
-
description: 'The unique ID of the event (e.g., "abc123def456"). You can find this in the event URL or from other calendar actions.',
|
|
20
|
-
required: true,
|
|
21
|
-
}),
|
|
22
|
-
max_attendees: pieces_framework_1.Property.Number({
|
|
23
|
-
displayName: 'Max Attendees',
|
|
24
|
-
description: 'Maximum number of attendees to include in the response. If there are more attendees, only the participant is returned.',
|
|
25
|
-
required: false,
|
|
26
|
-
}),
|
|
27
|
-
time_zone: pieces_framework_1.Property.ShortText({
|
|
28
|
-
displayName: 'Time Zone',
|
|
29
|
-
description: 'Time zone for the response (e.g., "America/New_York", "Europe/London"). Defaults to the calendar\'s time zone if not specified.',
|
|
30
|
-
required: false,
|
|
31
|
-
}),
|
|
32
|
-
},
|
|
33
|
-
run(context) {
|
|
34
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
35
|
-
var _a, _b, _c, _d;
|
|
36
|
-
const { calendar_id: calendarId, event_id: eventId, max_attendees: maxAttendees, time_zone: timeZone, } = context.propsValue;
|
|
37
|
-
const token = yield (0, common_1.getAccessToken)(context.auth);
|
|
38
|
-
if (!calendarId ||
|
|
39
|
-
typeof calendarId !== 'string' ||
|
|
40
|
-
calendarId.trim().length === 0) {
|
|
41
|
-
throw new Error('Calendar ID is required');
|
|
42
|
-
}
|
|
43
|
-
if (!eventId ||
|
|
44
|
-
typeof eventId !== 'string' ||
|
|
45
|
-
eventId.trim().length === 0) {
|
|
46
|
-
throw new Error('Event ID cannot be empty');
|
|
47
|
-
}
|
|
48
|
-
if (eventId.length < 5 || eventId.length > 1024) {
|
|
49
|
-
throw new Error('Event ID must be between 5 and 1024 characters');
|
|
50
|
-
}
|
|
51
|
-
const queryParams = {};
|
|
52
|
-
if (maxAttendees !== undefined && maxAttendees > 0) {
|
|
53
|
-
queryParams.maxAttendees = maxAttendees.toString();
|
|
54
|
-
}
|
|
55
|
-
if (timeZone &&
|
|
56
|
-
typeof timeZone === 'string' &&
|
|
57
|
-
timeZone.trim().length > 0) {
|
|
58
|
-
queryParams.timeZone = timeZone.trim();
|
|
59
|
-
}
|
|
60
|
-
const url = `${common_1.googleCalendarCommon.baseUrl}/calendars/${encodeURIComponent(calendarId.trim())}/events/${encodeURIComponent(eventId.trim())}`;
|
|
61
|
-
const request = {
|
|
62
|
-
method: pieces_common_1.HttpMethod.GET,
|
|
63
|
-
url: url,
|
|
64
|
-
queryParams: queryParams,
|
|
65
|
-
authentication: {
|
|
66
|
-
type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
|
|
67
|
-
token: token,
|
|
68
|
-
},
|
|
69
|
-
};
|
|
70
|
-
try {
|
|
71
|
-
const response = yield pieces_common_1.httpClient.sendRequest(request);
|
|
72
|
-
return response.body;
|
|
73
|
-
}
|
|
74
|
-
catch (error) {
|
|
75
|
-
if (((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) === 404) {
|
|
76
|
-
throw new Error(`Event with ID "${eventId}" not found in calendar "${calendarId}". Please verify the event ID and calendar selection.`);
|
|
77
|
-
}
|
|
78
|
-
else if (((_b = error.response) === null || _b === void 0 ? void 0 : _b.status) === 403) {
|
|
79
|
-
throw new Error(`Access denied to event "${eventId}" in calendar "${calendarId}". Please check your permissions.`);
|
|
80
|
-
}
|
|
81
|
-
else if (((_c = error.response) === null || _c === void 0 ? void 0 : _c.status) === 400) {
|
|
82
|
-
throw new Error(`Invalid request parameters. Please check the event ID format and other parameters.`);
|
|
83
|
-
}
|
|
84
|
-
else if (((_d = error.response) === null || _d === void 0 ? void 0 : _d.status) === 401) {
|
|
85
|
-
throw new Error('Authentication failed. Please reconnect your Google Calendar account.');
|
|
86
|
-
}
|
|
87
|
-
else {
|
|
88
|
-
throw new Error(`Failed to fetch event: ${error.message || 'Unknown error occurred'}`);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
},
|
|
93
|
-
});
|
|
94
|
-
//# 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,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KAAK,CACb,kBAAkB,OAAO,4BAA4B,UAAU,uDAAuD,CACvH,CAAC;gBACJ,CAAC;qBAAM,IAAI,CAAA,MAAA,KAAK,CAAC,QAAQ,0CAAE,MAAM,MAAK,GAAG,EAAE,CAAC;oBAC1C,MAAM,IAAI,KAAK,CACb,2BAA2B,OAAO,kBAAkB,UAAU,mCAAmC,CAClG,CAAC;gBACJ,CAAC;qBAAM,IAAI,CAAA,MAAA,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;;;;;;;;;;;;;EAsGpB,CAAC"}
|
|
@@ -1,100 +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
|
-
audience: 'both',
|
|
14
|
-
aiMetadata: { description: 'Lists events from a Google Calendar, optionally filtered by a date range, search term, and event types, and can expand recurring events into individual instances. Use to look up or browse multiple events when you do not already have a specific event ID; use Get Event by ID for a single known event. Read-only and idempotent.', idempotent: true },
|
|
15
|
-
displayName: 'Get all Events',
|
|
16
|
-
props: {
|
|
17
|
-
calendar_id: common_1.googleCalendarCommon.calendarDropdown('writer'),
|
|
18
|
-
event_types: pieces_framework_1.Property.StaticMultiSelectDropdown({
|
|
19
|
-
displayName: 'Event types',
|
|
20
|
-
description: 'Select event types',
|
|
21
|
-
required: true,
|
|
22
|
-
defaultValue: ['default', 'focusTime', 'outOfOffice'],
|
|
23
|
-
options: {
|
|
24
|
-
options: [
|
|
25
|
-
{
|
|
26
|
-
label: 'Default',
|
|
27
|
-
value: 'default',
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
label: 'Out Of Office',
|
|
31
|
-
value: 'outOfOffice',
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
label: 'Focus Time',
|
|
35
|
-
value: 'focusTime',
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
label: 'Working Location',
|
|
39
|
-
value: 'workingLocation',
|
|
40
|
-
},
|
|
41
|
-
],
|
|
42
|
-
},
|
|
43
|
-
}),
|
|
44
|
-
search: pieces_framework_1.Property.ShortText({
|
|
45
|
-
displayName: 'Search Term',
|
|
46
|
-
required: false,
|
|
47
|
-
}),
|
|
48
|
-
start_date: pieces_framework_1.Property.DateTime({
|
|
49
|
-
displayName: 'Date from',
|
|
50
|
-
required: false,
|
|
51
|
-
}),
|
|
52
|
-
end_date: pieces_framework_1.Property.DateTime({
|
|
53
|
-
displayName: 'Date to',
|
|
54
|
-
required: false,
|
|
55
|
-
}),
|
|
56
|
-
singleEvents: pieces_framework_1.Property.Checkbox({
|
|
57
|
-
displayName: 'Expand Recurring Event?',
|
|
58
|
-
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.",
|
|
59
|
-
required: true,
|
|
60
|
-
defaultValue: false,
|
|
61
|
-
}),
|
|
62
|
-
},
|
|
63
|
-
run(configValue) {
|
|
64
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
65
|
-
// docs: https://developers.google.com/calendar/api/v3/reference/events/list
|
|
66
|
-
const { calendar_id: calendarId, start_date, end_date, search, event_types, singleEvents, } = configValue.propsValue;
|
|
67
|
-
const token = yield (0, common_1.getAccessToken)(configValue.auth);
|
|
68
|
-
const queryParams = { showDeleted: 'false' };
|
|
69
|
-
let url = `${common_1.googleCalendarCommon.baseUrl}/calendars/${calendarId}/events`;
|
|
70
|
-
if (singleEvents !== null) {
|
|
71
|
-
queryParams['singleEvents'] = singleEvents ? 'true' : 'false';
|
|
72
|
-
}
|
|
73
|
-
if (search) {
|
|
74
|
-
queryParams['q'] = `"${search}"`;
|
|
75
|
-
}
|
|
76
|
-
// date range
|
|
77
|
-
if (start_date) {
|
|
78
|
-
queryParams['timeMin'] = (0, dayjs_1.default)(start_date).format('YYYY-MM-DDTHH:mm:ss.sssZ');
|
|
79
|
-
}
|
|
80
|
-
if (start_date && end_date) {
|
|
81
|
-
queryParams['timeMax'] = (0, dayjs_1.default)(end_date).format('YYYY-MM-DDTHH:mm:ss.sssZ');
|
|
82
|
-
}
|
|
83
|
-
// filter by event type
|
|
84
|
-
if (event_types.length > 0) {
|
|
85
|
-
url += `?${event_types.map((type) => `eventTypes=${type}`).join('&')}`;
|
|
86
|
-
}
|
|
87
|
-
const request = {
|
|
88
|
-
method: pieces_common_1.HttpMethod.GET,
|
|
89
|
-
url,
|
|
90
|
-
queryParams,
|
|
91
|
-
authentication: {
|
|
92
|
-
type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
|
|
93
|
-
token,
|
|
94
|
-
},
|
|
95
|
-
};
|
|
96
|
-
return yield pieces_common_1.httpClient.sendRequest(request);
|
|
97
|
-
});
|
|
98
|
-
},
|
|
99
|
-
});
|
|
100
|
-
//# 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;IAC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,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;;;;;;;;;;;;;;;;;;;;;;EA0H5B,CAAC"}
|
|
@@ -1,113 +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
|
-
audience: 'both',
|
|
15
|
-
aiMetadata: { description: 'Updates the fields of an existing Google Calendar event identified by calendar and event ID (title, times, location, description, color, attendees, guest permissions); unset fields retain their current values. Use to modify or reschedule an event that already exists rather than creating a new one. Requires the event ID. Idempotent: applying the same field values repeatedly leaves the event in the same state.', idempotent: true },
|
|
16
|
-
props: {
|
|
17
|
-
calendar_id: common_1.googleCalendarCommon.calendarDropdown('writer'),
|
|
18
|
-
eventId: pieces_framework_1.Property.ShortText({
|
|
19
|
-
displayName: 'Event ID',
|
|
20
|
-
required: true,
|
|
21
|
-
}),
|
|
22
|
-
title: pieces_framework_1.Property.ShortText({
|
|
23
|
-
displayName: 'Title of the event',
|
|
24
|
-
required: false,
|
|
25
|
-
}),
|
|
26
|
-
start_date_time: pieces_framework_1.Property.DateTime({
|
|
27
|
-
displayName: 'Start date time of the event',
|
|
28
|
-
required: false,
|
|
29
|
-
}),
|
|
30
|
-
end_date_time: pieces_framework_1.Property.DateTime({
|
|
31
|
-
displayName: 'End date time of the event',
|
|
32
|
-
required: false,
|
|
33
|
-
}),
|
|
34
|
-
location: pieces_framework_1.Property.ShortText({
|
|
35
|
-
displayName: 'Location',
|
|
36
|
-
required: false,
|
|
37
|
-
}),
|
|
38
|
-
description: pieces_framework_1.Property.LongText({
|
|
39
|
-
displayName: 'Description',
|
|
40
|
-
description: 'Description of the event. You can use HTML tags here.',
|
|
41
|
-
required: false,
|
|
42
|
-
}),
|
|
43
|
-
colorId: common_1.googleCalendarCommon.colorId,
|
|
44
|
-
attendees: pieces_framework_1.Property.Array({
|
|
45
|
-
displayName: 'Attendees',
|
|
46
|
-
description: 'Emails of the attendees (guests)',
|
|
47
|
-
required: false,
|
|
48
|
-
}),
|
|
49
|
-
guests_can_modify: pieces_framework_1.Property.Checkbox({
|
|
50
|
-
displayName: 'Guests can modify',
|
|
51
|
-
defaultValue: false,
|
|
52
|
-
required: false,
|
|
53
|
-
}),
|
|
54
|
-
guests_can_invite_others: pieces_framework_1.Property.Checkbox({
|
|
55
|
-
displayName: 'Guests can invite others',
|
|
56
|
-
defaultValue: false,
|
|
57
|
-
required: false,
|
|
58
|
-
}),
|
|
59
|
-
guests_can_see_other_guests: pieces_framework_1.Property.Checkbox({
|
|
60
|
-
displayName: 'Guests can see other guests',
|
|
61
|
-
defaultValue: false,
|
|
62
|
-
required: false,
|
|
63
|
-
}),
|
|
64
|
-
},
|
|
65
|
-
run(context) {
|
|
66
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
67
|
-
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;
|
|
68
|
-
const attendees = context.propsValue.attendees;
|
|
69
|
-
const authClient = yield (0, common_1.createGoogleClient)(context.auth);
|
|
70
|
-
const calendar = googleapis_1.google.calendar({ version: 'v3', auth: authClient });
|
|
71
|
-
// Note that each patch request consumes three quota units;
|
|
72
|
-
// prefer using a get followed by an update
|
|
73
|
-
const currentEvent = yield calendar.events.get({
|
|
74
|
-
calendarId: calendar_id,
|
|
75
|
-
eventId: eventId,
|
|
76
|
-
});
|
|
77
|
-
let attendeeFormattedList = [];
|
|
78
|
-
if (Array.isArray(attendees) && attendees.length > 0) {
|
|
79
|
-
attendeeFormattedList = attendees.map((email) => ({ email }));
|
|
80
|
-
}
|
|
81
|
-
else if (currentEvent.data.attendees &&
|
|
82
|
-
Array.isArray(currentEvent.data.attendees)) {
|
|
83
|
-
attendeeFormattedList = currentEvent.data.attendees;
|
|
84
|
-
}
|
|
85
|
-
const response = yield calendar.events.update({
|
|
86
|
-
calendarId: calendar_id,
|
|
87
|
-
eventId: eventId,
|
|
88
|
-
requestBody: {
|
|
89
|
-
summary: title !== null && title !== void 0 ? title : currentEvent.data.summary,
|
|
90
|
-
attendees: attendeeFormattedList,
|
|
91
|
-
description: description !== null && description !== void 0 ? description : currentEvent.data.description,
|
|
92
|
-
colorId: colorId,
|
|
93
|
-
location: location !== null && location !== void 0 ? location : currentEvent.data.location,
|
|
94
|
-
start: start_date_time
|
|
95
|
-
? {
|
|
96
|
-
dateTime: (0, dayjs_1.default)(start_date_time).format('YYYY-MM-DDTHH:mm:ss.sssZ'),
|
|
97
|
-
}
|
|
98
|
-
: currentEvent.data.start,
|
|
99
|
-
end: end_date_time
|
|
100
|
-
? {
|
|
101
|
-
dateTime: (0, dayjs_1.default)(end_date_time).format('YYYY-MM-DDTHH:mm:ss.sssZ'),
|
|
102
|
-
}
|
|
103
|
-
: currentEvent.data.end,
|
|
104
|
-
guestsCanInviteOthers: guests_can_invite_others,
|
|
105
|
-
guestsCanModify: guests_can_modify,
|
|
106
|
-
guestsCanSeeOtherGuests: guests_can_see_other_guests,
|
|
107
|
-
},
|
|
108
|
-
});
|
|
109
|
-
return response.data;
|
|
110
|
-
});
|
|
111
|
-
},
|
|
112
|
-
});
|
|
113
|
-
//# 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,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,EAAE,WAAW,EAAE,6ZAA6Z,EAAE,UAAU,EAAE,IAAI,EAAE;IAC5c,KAAK,EAAE;QACL,WAAW,EAAE,6BAAoB,CAAC,gBAAgB,CAAC,QAAQ,CAAC;QAC5D,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC1B,WAAW,EAAE,UAAU;YACvB,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACxB,WAAW,EAAE,oBAAoB;YACjC,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,eAAe,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACjC,WAAW,EAAE,8BAA8B;YAC3C,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF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I,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,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/lib/auth.ts"],"names":[],"mappings":";;;AAsDA,gDAaC;;AAnED,qEAAwG;AACxG,iDAAyD;AACzD,2CAAoC;AACpC,yDAAiD;AAEpC,QAAA,oBAAoB,GAAG;IAClC,iDAAiD;IACjD,mDAAmD;IACnD,oDAAoD;IACpD,0DAA0D;CAC3D,CAAC;AAEW,QAAA,kBAAkB,GAAG,CAAC,4BAAS,CAAC,MAAM,CAAC;QAClD,WAAW,EAAE,EAAE;QACf,OAAO,EAAE,2CAA2C;QACpD,QAAQ,EA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AC/B,MAAM,EAAE,4BAAoB;gBAC5B,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS;aAC9B,CAAC,CAAC;QACL,CAAC;QACD,MAAM,UAAU,GAAG,IAAI,gCAAY,EAAE,CAAC;QACtC,UAAU,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;QAChC,OAAO,UAAU,CAAC;IACpB,CAAC;CAAA;AAEM,MAAM,cAAc,GAAG,CAAO,IAA6B,EAAmB,EAAE;IACrF,IAAI,IAAI,CAAC,IAAI,KAAK,0BAAiB,CAAC,WAAW,EAAE,CAAC;QAChD,MAAM,YAAY,GAAG,MAAM,kBAAkB,CAAC,IAAI,CAAC,CAAC;QACpD,MAAM,QAAQ,GAAG,MAAM,YAAY,CAAC,cAAc,EAAE,CAAC;QACrD,IAAI,QAAQ,CAAC,KAAK,EAAE,CAAC;YACnB,OAAO,QAAQ,CAAC,KAAK,CAAC;QACxB,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,2DAA2D,CAAC,CAAC;QAC/E,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC,YAAY,CAAC;AAC3B,CAAC,CAAA,CAAC;AAXW,QAAA,cAAc,kBAWzB"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { GoogleCalendarAuthValue } from '.';
|
|
2
|
-
import { GoogleWatchResponse, CalendarObject, 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,MAAM,GAAG,CAAC;AAClF,OAAO,EACL,mBAAmB,EAEnB,cAAc,EAEd,mBAAmB,EAEnB,iBAAiB,EAClB,MAAM,SAAS,CAAC;AAEjB,wBAAsB,cAAc,CAClC,IAAI,EAAE,mBAAmB,EACzB,QAAQ,EAAE,uBAAuB,iBAelC;AAED,wBAAsB,UAAU,CAC9B,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,uBAAuB,GAChC,OAAO,CAAC,mBAAmB,CAAC,CAoB9B;AAED,wBAAsB,mBAAmB,CAAC,EACxC,UAAU,EACV,QAAQ,GAC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