caldav-adapter 4.3.0 → 4.3.1
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/lib/common/eventBuild.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const ical_generator_1 = __importDefault(require("ical-generator"));
|
|
7
7
|
const moment_1 = __importDefault(require("moment"));
|
|
8
8
|
const date_1 = require("../common/date");
|
|
9
|
-
const rrule_1 =
|
|
9
|
+
const rrule_1 = require("rrule");
|
|
10
10
|
const FIXED_DOMAIN = 'DOMAIN_TO_REMOVE';
|
|
11
11
|
/**
|
|
12
12
|
* Adapted from https://github.com/sebbo2002/ical-generator
|
|
@@ -130,7 +130,7 @@ function default_1(opts) {
|
|
|
130
130
|
}
|
|
131
131
|
if (parsed.rrule) {
|
|
132
132
|
obj.recurring = {
|
|
133
|
-
freq: rrule_1.
|
|
133
|
+
freq: rrule_1.RRule.FREQUENCIES[parsed.rrule.origOptions.freq]
|
|
134
134
|
};
|
|
135
135
|
if (parsed.rrule.origOptions.until) {
|
|
136
136
|
obj.recurring.until = (0, date_1.formatted)(parsed.rrule.origOptions.until);
|
|
@@ -36,18 +36,24 @@ function default_1(opts) {
|
|
|
36
36
|
return async function (ctx, calendar) {
|
|
37
37
|
/* https://tools.ietf.org/html/rfc4791#section-9.9 */
|
|
38
38
|
const filters = xml.get('/CAL:calendar-query/CAL:filter/CAL:comp-filter[@name=\'VCALENDAR\']/CAL:comp-filter[@name=\'VEVENT\']/CAL:time-range', ctx.request.xml);
|
|
39
|
+
const { children } = xml.getWithChildren('/CAL:calendar-query/D:prop', ctx.request.xml);
|
|
40
|
+
const fullData = lodash_1.default.some(children, (child) => {
|
|
41
|
+
return child.localName === 'calendar-data';
|
|
42
|
+
});
|
|
39
43
|
if (!filters || !filters[0]) {
|
|
40
|
-
|
|
44
|
+
const events = await opts.data.getEventsForCalendar({
|
|
45
|
+
principalId: ctx.state.params.principalId,
|
|
46
|
+
calendarId: calendar.calendarId,
|
|
47
|
+
user: ctx.state.user,
|
|
48
|
+
fullData: fullData
|
|
49
|
+
});
|
|
50
|
+
return await eventResponse(ctx, events, calendar, children);
|
|
41
51
|
}
|
|
42
52
|
const filter = filters[0];
|
|
43
53
|
const startAttr = lodash_1.default.find(filter.attributes, { localName: 'start' });
|
|
44
54
|
const start = startAttr ? (0, date_1.formatted)(startAttr.nodeValue) : null;
|
|
45
55
|
const endAttr = lodash_1.default.find(filter.attributes, { localName: 'end' });
|
|
46
56
|
const end = endAttr ? (0, date_1.formatted)(endAttr.nodeValue) : null;
|
|
47
|
-
const { children } = xml.getWithChildren('/CAL:calendar-query/D:prop', ctx.request.xml);
|
|
48
|
-
const fullData = lodash_1.default.some(children, (child) => {
|
|
49
|
-
return child.localName === 'calendar-data';
|
|
50
|
-
});
|
|
51
57
|
const events = await opts.data.getEventsByDate({
|
|
52
58
|
principalId: ctx.state.params.principalId,
|
|
53
59
|
calendarId: calendar.calendarId,
|