caldav-adapter 4.2.0 → 4.3.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.
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.formatted = void 0;
7
7
  const moment_1 = __importDefault(require("moment"));
8
- exports.formatted = function (date) {
9
- return moment_1.default(date).utc().format('YYYYMMDDTHHmmss[Z]');
8
+ const formatted = function (date) {
9
+ return (0, moment_1.default)(date).utc().format('YYYYMMDDTHHmmss[Z]');
10
10
  };
11
+ exports.formatted = formatted;
@@ -43,8 +43,8 @@ function default_1(opts) {
43
43
  const evt = {
44
44
  id: event.eventId,
45
45
  sequence: 1,
46
- start: moment_1.default(event.startDate).toDate(),
47
- end: moment_1.default(event.endDate).toDate(),
46
+ start: (0, moment_1.default)(event.startDate).toDate(),
47
+ end: (0, moment_1.default)(event.endDate).toDate(),
48
48
  summary: event.summary,
49
49
  location: event.location,
50
50
  description: event.description,
@@ -52,9 +52,11 @@ function default_1(opts) {
52
52
  url: event.url,
53
53
  // categories: categories,
54
54
  alarms: event.alarms,
55
- created: moment_1.default(event.createdOn).toDate(),
56
- lastModified: event.lastModifiedOn ? moment_1.default(event.createdOn).toDate() : undefined,
55
+ created: (0, moment_1.default)(event.createdOn).toDate(),
56
+ lastModified: event.lastModifiedOn ? (0, moment_1.default)(event.createdOn).toDate() : undefined,
57
57
  timezone: event.timeZone || calendar.timeZone,
58
+ // role: 'REQ-PARTICIPANT',
59
+ // rsvp: true
58
60
  };
59
61
  const recur = [];
60
62
  if (event.recurring) {
@@ -63,10 +65,10 @@ function default_1(opts) {
63
65
  freq: event.recurring.freq
64
66
  };
65
67
  if (event.recurring.until) {
66
- evt.repeating.until = moment_1.default(event.recurring.until).toDate();
68
+ evt.repeating.until = (0, moment_1.default)(event.recurring.until).toDate();
67
69
  }
68
70
  if ((_a = event.recurring.exdate) === null || _a === void 0 ? void 0 : _a.length) {
69
- evt.repeating.exclude = event.recurring.exdate.map((e) => moment_1.default(e).toDate());
71
+ evt.repeating.exclude = event.recurring.exdate.map((e) => (0, moment_1.default)(e).toDate());
70
72
  }
71
73
  if ((_b = event.recurring.recurrences) === null || _b === void 0 ? void 0 : _b.length) {
72
74
  recur.push(...event.recurring.recurrences.map((r) => {
@@ -75,10 +77,10 @@ function default_1(opts) {
75
77
  // });
76
78
  const rEvent = {
77
79
  id: event.eventId,
78
- recurrenceId: moment_1.default(r.recurrenceId).toDate(),
80
+ recurrenceId: (0, moment_1.default)(r.recurrenceId).toDate(),
79
81
  sequence: 1,
80
- start: moment_1.default(r.startDate).toDate(),
81
- end: moment_1.default(r.endDate).toDate(),
82
+ start: (0, moment_1.default)(r.startDate).toDate(),
83
+ end: (0, moment_1.default)(r.endDate).toDate(),
82
84
  summary: r.summary,
83
85
  location: r.location,
84
86
  description: r.description,
@@ -86,8 +88,8 @@ function default_1(opts) {
86
88
  url: r.url,
87
89
  // categories: rCategories,
88
90
  alarms: r.alarms,
89
- created: moment_1.default(r.createdOn).toDate(),
90
- lastModified: r.lastModifiedOn ? moment_1.default(r.lastModifiedOn).toDate() : undefined,
91
+ created: (0, moment_1.default)(r.createdOn).toDate(),
92
+ lastModified: r.lastModifiedOn ? (0, moment_1.default)(r.lastModifiedOn).toDate() : undefined,
91
93
  timezone: r.timeZone || event.timeZone || calendar.timeZone,
92
94
  };
93
95
  return rEvent;
@@ -95,7 +97,7 @@ function default_1(opts) {
95
97
  }
96
98
  }
97
99
  const events = [evt, ...recur];
98
- const cal = ical_generator_1.default({
100
+ const cal = (0, ical_generator_1.default)({
99
101
  domain: FIXED_DOMAIN,
100
102
  prodId: opts.proId,
101
103
  timezone: calendar.timeZone,
@@ -113,49 +115,49 @@ function default_1(opts) {
113
115
  summary: parsed.summary,
114
116
  location: parsed.location,
115
117
  description: parsed.description,
116
- startDate: parsed.start ? date_1.formatted(parsed.start) : null,
117
- endDate: parsed.end ? date_1.formatted(parsed.end) : null,
118
+ startDate: parsed.start ? (0, date_1.formatted)(parsed.start) : null,
119
+ endDate: parsed.end ? (0, date_1.formatted)(parsed.end) : null,
118
120
  duration: parsed.duration ? parsed.duration.toString() : null,
119
121
  // @ts-ignore
120
122
  timeZone: parsed.start.tz,
121
- createdOn: parsed.dtstamp ? date_1.formatted(parsed.dtstamp) : null,
122
- lastModifiedOn: parsed.lastmodified ? date_1.formatted(parsed.lastmodified) : null,
123
+ createdOn: parsed.dtstamp ? (0, date_1.formatted)(parsed.dtstamp) : null,
124
+ lastModifiedOn: parsed.lastmodified ? (0, date_1.formatted)(parsed.lastmodified) : null,
123
125
  ical: ical
124
126
  };
125
127
  if (!obj.endDate && obj.duration) {
126
- const end = moment_1.default(parsed.start).add(moment_1.default.duration(obj.duration));
127
- obj.endDate = date_1.formatted(end);
128
+ const end = (0, moment_1.default)(parsed.start).add(moment_1.default.duration(obj.duration));
129
+ obj.endDate = (0, date_1.formatted)(end);
128
130
  }
129
131
  if (parsed.rrule) {
130
132
  obj.recurring = {
131
- freq: rrule_1.default.FREQUENCIES[parsed.rrule.origOptions.freq]
133
+ freq: rrule_1.default.RRule.FREQUENCIES[parsed.rrule.origOptions.freq]
132
134
  };
133
135
  if (parsed.rrule.origOptions.until) {
134
- obj.recurring.until = date_1.formatted(parsed.rrule.origOptions.until);
136
+ obj.recurring.until = (0, date_1.formatted)(parsed.rrule.origOptions.until);
135
137
  }
136
138
  if (parsed.exdate && Object.values(parsed.exdate).length) {
137
139
  obj.recurring.exdate = Object.values(parsed.exdate).map((ex) => {
138
- return date_1.formatted(ex);
140
+ return (0, date_1.formatted)(ex);
139
141
  });
140
142
  }
141
143
  if (parsed.recurrences && Object.values(parsed.recurrences).length) {
142
144
  obj.recurring.recurrences = Object.values(parsed.recurrences).map((r) => {
143
145
  const rObj = {
144
- recurrenceId: date_1.formatted(r.recurrenceid),
146
+ recurrenceId: (0, date_1.formatted)(r.recurrenceid),
145
147
  summary: r.summary,
146
148
  location: r.location,
147
149
  description: r.description,
148
- startDate: r.start ? date_1.formatted(r.start) : null,
149
- endDate: r.end ? date_1.formatted(r.end) : null,
150
+ startDate: r.start ? (0, date_1.formatted)(r.start) : null,
151
+ endDate: r.end ? (0, date_1.formatted)(r.end) : null,
150
152
  duration: r.duration ? r.duration.toString() : null,
151
153
  // @ts-ignore
152
154
  timeZone: r.start.tz,
153
- createdOn: parsed.dtstamp ? date_1.formatted(parsed.dtstamp) : null,
154
- lastModifiedOn: parsed.lastmodified ? date_1.formatted(parsed.lastmodified) : null
155
+ createdOn: parsed.dtstamp ? (0, date_1.formatted)(parsed.dtstamp) : null,
156
+ lastModifiedOn: parsed.lastmodified ? (0, date_1.formatted)(parsed.lastmodified) : null
155
157
  };
156
158
  if (!rObj.endDate && rObj.duration) {
157
- const end = moment_1.default(r.start).add(moment_1.default.duration(rObj.duration));
158
- rObj.endDate = date_1.formatted(end);
159
+ const end = (0, moment_1.default)(r.start).add(moment_1.default.duration(rObj.duration));
160
+ rObj.endDate = (0, date_1.formatted)(end);
159
161
  }
160
162
  return rObj;
161
163
  });
@@ -7,7 +7,7 @@ const raw_body_1 = __importDefault(require("raw-body"));
7
7
  const xmldom_1 = require("xmldom");
8
8
  const ical_1 = __importDefault(require("ical"));
9
9
  async function default_1(ctx) {
10
- ctx.request.body = await raw_body_1.default(ctx.req, {
10
+ ctx.request.body = await (0, raw_body_1.default)(ctx.req, {
11
11
  encoding: true,
12
12
  limit: '1mb' // practical
13
13
  });
@@ -12,30 +12,42 @@ const setDAVHeader = function (ctx) {
12
12
  // 'extended-mkcol',
13
13
  'calendar-access',
14
14
  'calendar-schedule',
15
+ // 'calendar-auto-schedule',
16
+ /* https://github.com/apple/ccs-calendarserver/blob/master/doc/Extensions/caldav-proxy.txt */
17
+ // 'calendar-proxy',
18
+ // 'calendarserver-sharing',
19
+ // 'calendarserver-subscribed',
20
+ // 'access-control',
21
+ /* https://tools.ietf.org/html/rfc3744#section-9.4 */
22
+ // 'calendarserver-principal-property-search'
15
23
  ].join(', '));
16
24
  };
17
25
  const setXMLHeader = function (ctx) {
18
26
  ctx.set('Content-Type', 'application/xml; charset="utf-8"');
19
27
  };
20
28
  /* https://tools.ietf.org/html/rfc4791#section-5.1.1 */
21
- exports.setOptions = function (ctx, methods) {
29
+ const setOptions = function (ctx, methods) {
22
30
  ctx.status = 200;
23
31
  setAllowHeader(ctx, methods);
24
32
  setDAVHeader(ctx);
25
33
  ctx.body = '';
26
34
  };
35
+ exports.setOptions = setOptions;
27
36
  /* https://tools.ietf.org/html/rfc4791#section-7.8.1 */
28
- exports.setMultistatusResponse = function (ctx) {
37
+ const setMultistatusResponse = function (ctx) {
29
38
  ctx.status = 207;
30
39
  setDAVHeader(ctx);
31
40
  setXMLHeader(ctx);
32
41
  };
42
+ exports.setMultistatusResponse = setMultistatusResponse;
33
43
  /* https://tools.ietf.org/html/rfc4791#section-5.3.2 */
34
- exports.setEventPutResponse = function (ctx, event) {
44
+ const setEventPutResponse = function (ctx, event) {
35
45
  ctx.status = 201;
36
46
  ctx.set('ETag', event.lastModifiedOn);
37
47
  };
38
- exports.setMissingMethod = function (ctx) {
48
+ exports.setEventPutResponse = setEventPutResponse;
49
+ const setMissingMethod = function (ctx) {
39
50
  ctx.status = 404;
40
51
  ctx.set('Content-Type', 'text/html; charset="utf-8"');
41
52
  };
53
+ exports.setMissingMethod = setMissingMethod;
@@ -11,15 +11,15 @@ const cal = 'urn:ietf:params:xml:ns:caldav';
11
11
  const cs = 'http://calendarserver.org/ns/';
12
12
  const ical = 'http://apple.com/ns/ical/';
13
13
  function default_1(opts) {
14
- const log = winston_1.default(Object.assign(Object.assign({}, opts), { label: 'tags' }));
15
- const { buildICS } = eventBuild_1.default(opts);
14
+ const log = (0, winston_1.default)(Object.assign(Object.assign({}, opts), { label: 'tags' }));
15
+ const { buildICS } = (0, eventBuild_1.default)(opts);
16
16
  const tags = {
17
17
  [dav]: {
18
18
  'current-user-principal': {
19
19
  doc: 'https://tools.ietf.org/html/rfc5397#section-3',
20
20
  resp: async ({ ctx }) => {
21
21
  return {
22
- [xBuild_1.buildTag(dav, 'current-user-principal')]: xBuild_1.href(ctx.state.principalUrl)
22
+ [(0, xBuild_1.buildTag)(dav, 'current-user-principal')]: (0, xBuild_1.href)(ctx.state.principalUrl)
23
23
  };
24
24
  }
25
25
  },
@@ -27,23 +27,23 @@ function default_1(opts) {
27
27
  doc: 'https://tools.ietf.org/html/rfc3744#section-5.4',
28
28
  resp: async ({ resource, calendar }) => {
29
29
  if (resource === 'calendar') {
30
- const privileges = [{ [xBuild_1.buildTag(dav, 'read')]: '' }];
30
+ const privileges = [{ [(0, xBuild_1.buildTag)(dav, 'read')]: '' }];
31
31
  if (!calendar.readOnly) {
32
32
  privileges.push(...[
33
- { [xBuild_1.buildTag(dav, 'read')]: '' },
34
- { [xBuild_1.buildTag(dav, 'read-acl')]: '' },
35
- { [xBuild_1.buildTag(dav, 'read-current-user-privilege-set')]: '' },
36
- { [xBuild_1.buildTag(dav, 'write')]: '' },
37
- { [xBuild_1.buildTag(dav, 'write-content')]: '' },
38
- { [xBuild_1.buildTag(dav, 'write-properties')]: '' },
39
- { [xBuild_1.buildTag(dav, 'bind')]: '' },
40
- { [xBuild_1.buildTag(dav, 'unbind')]: '' },
41
- { [xBuild_1.buildTag(cal, 'read-free-busy')]: '' } // https://tools.ietf.org/html/rfc4791#section-6.1.1
33
+ { [(0, xBuild_1.buildTag)(dav, 'read')]: '' },
34
+ { [(0, xBuild_1.buildTag)(dav, 'read-acl')]: '' },
35
+ { [(0, xBuild_1.buildTag)(dav, 'read-current-user-privilege-set')]: '' },
36
+ { [(0, xBuild_1.buildTag)(dav, 'write')]: '' },
37
+ { [(0, xBuild_1.buildTag)(dav, 'write-content')]: '' },
38
+ { [(0, xBuild_1.buildTag)(dav, 'write-properties')]: '' },
39
+ { [(0, xBuild_1.buildTag)(dav, 'bind')]: '' }, // PUT - https://tools.ietf.org/html/rfc3744#section-3.9
40
+ { [(0, xBuild_1.buildTag)(dav, 'unbind')]: '' }, // DELETE - https://tools.ietf.org/html/rfc3744#section-3.10
41
+ { [(0, xBuild_1.buildTag)(cal, 'read-free-busy')]: '' } // https://tools.ietf.org/html/rfc4791#section-6.1.1
42
42
  ]);
43
43
  }
44
44
  return {
45
- [xBuild_1.buildTag(dav, 'current-user-privilege-set')]: {
46
- [xBuild_1.buildTag(dav, 'privilege')]: privileges
45
+ [(0, xBuild_1.buildTag)(dav, 'current-user-privilege-set')]: {
46
+ [(0, xBuild_1.buildTag)(dav, 'privilege')]: privileges
47
47
  }
48
48
  };
49
49
  }
@@ -54,12 +54,12 @@ function default_1(opts) {
54
54
  resp: async ({ resource, ctx, calendar }) => {
55
55
  if (resource === 'principal') {
56
56
  return {
57
- [xBuild_1.buildTag(dav, 'displayname')]: ctx.state.user.principalName
57
+ [(0, xBuild_1.buildTag)(dav, 'displayname')]: ctx.state.user.principalName
58
58
  };
59
59
  }
60
60
  else if (resource === 'calendar') {
61
61
  return {
62
- [xBuild_1.buildTag(dav, 'displayname')]: calendar.calendarName
62
+ [(0, xBuild_1.buildTag)(dav, 'displayname')]: calendar.calendarName
63
63
  };
64
64
  }
65
65
  }
@@ -69,12 +69,12 @@ function default_1(opts) {
69
69
  resp: async ({ resource }) => {
70
70
  if (resource === 'calendar') {
71
71
  return {
72
- [xBuild_1.buildTag(dav, 'getcontenttype')]: 'text/calendar; charset=utf-8; component=VEVENT'
72
+ [(0, xBuild_1.buildTag)(dav, 'getcontenttype')]: 'text/calendar; charset=utf-8; component=VEVENT'
73
73
  };
74
74
  }
75
75
  else if (resource === 'event') {
76
76
  return {
77
- [xBuild_1.buildTag(dav, 'getcontenttype')]: 'text/calendar; charset=utf-8; component=VEVENT'
77
+ [(0, xBuild_1.buildTag)(dav, 'getcontenttype')]: 'text/calendar; charset=utf-8; component=VEVENT'
78
78
  };
79
79
  }
80
80
  }
@@ -84,7 +84,7 @@ function default_1(opts) {
84
84
  resp: async ({ resource, event }) => {
85
85
  if (resource === 'event') {
86
86
  return {
87
- [xBuild_1.buildTag(dav, 'getetag')]: event.lastModifiedOn
87
+ [(0, xBuild_1.buildTag)(dav, 'getetag')]: event.lastModifiedOn
88
88
  };
89
89
  }
90
90
  }
@@ -94,7 +94,7 @@ function default_1(opts) {
94
94
  resp: async ({ resource, ctx }) => {
95
95
  if (resource === 'calendar') {
96
96
  return {
97
- [xBuild_1.buildTag(dav, 'owner')]: xBuild_1.href(ctx.state.principalUrl)
97
+ [(0, xBuild_1.buildTag)(dav, 'owner')]: (0, xBuild_1.href)(ctx.state.principalUrl)
98
98
  };
99
99
  }
100
100
  }
@@ -104,7 +104,7 @@ function default_1(opts) {
104
104
  resp: async ({ resource, ctx }) => {
105
105
  if (resource === 'principal') {
106
106
  return {
107
- [xBuild_1.buildTag(dav, 'principal-collection-set')]: xBuild_1.href(ctx.state.principalRootUrl)
107
+ [(0, xBuild_1.buildTag)(dav, 'principal-collection-set')]: (0, xBuild_1.href)(ctx.state.principalRootUrl)
108
108
  };
109
109
  }
110
110
  }
@@ -113,7 +113,7 @@ function default_1(opts) {
113
113
  doc: 'https://tools.ietf.org/html/rfc3744#section-4.2',
114
114
  resp: async ({ ctx }) => {
115
115
  return {
116
- [xBuild_1.buildTag(dav, 'principal-URL')]: xBuild_1.href(ctx.state.principalUrl)
116
+ [(0, xBuild_1.buildTag)(dav, 'principal-URL')]: (0, xBuild_1.href)(ctx.state.principalUrl)
117
117
  };
118
118
  }
119
119
  },
@@ -125,16 +125,16 @@ function default_1(opts) {
125
125
  resp: async ({ resource }) => {
126
126
  if (resource === 'calCollection') {
127
127
  return {
128
- [xBuild_1.buildTag(dav, 'resourcetype')]: {
129
- [xBuild_1.buildTag(dav, 'collection')]: ''
128
+ [(0, xBuild_1.buildTag)(dav, 'resourcetype')]: {
129
+ [(0, xBuild_1.buildTag)(dav, 'collection')]: ''
130
130
  }
131
131
  };
132
132
  }
133
133
  else if (resource === 'calendar') {
134
134
  return {
135
- [xBuild_1.buildTag(dav, 'resourcetype')]: {
136
- [xBuild_1.buildTag(dav, 'collection')]: '',
137
- [xBuild_1.buildTag(cal, 'calendar')]: ''
135
+ [(0, xBuild_1.buildTag)(dav, 'resourcetype')]: {
136
+ [(0, xBuild_1.buildTag)(dav, 'collection')]: '',
137
+ [(0, xBuild_1.buildTag)(cal, 'calendar')]: ''
138
138
  }
139
139
  };
140
140
  }
@@ -145,20 +145,20 @@ function default_1(opts) {
145
145
  resp: async ({ resource }) => {
146
146
  if (resource === 'calCollection') {
147
147
  return {
148
- [xBuild_1.buildTag(dav, 'supported-report-set')]: {
149
- [xBuild_1.buildTag(dav, 'supported-report')]: {
150
- [xBuild_1.buildTag(dav, 'report')]: { [xBuild_1.buildTag(cal, 'sync-collection')]: '' }
148
+ [(0, xBuild_1.buildTag)(dav, 'supported-report-set')]: {
149
+ [(0, xBuild_1.buildTag)(dav, 'supported-report')]: {
150
+ [(0, xBuild_1.buildTag)(dav, 'report')]: { [(0, xBuild_1.buildTag)(cal, 'sync-collection')]: '' }
151
151
  }
152
152
  }
153
153
  };
154
154
  }
155
155
  else if (resource === 'calendar') {
156
156
  return {
157
- [xBuild_1.buildTag(dav, 'supported-report-set')]: {
158
- [xBuild_1.buildTag(dav, 'supported-report')]: [
159
- { [xBuild_1.buildTag(dav, 'report')]: { [xBuild_1.buildTag(cal, 'calendar-query')]: '' } },
160
- { [xBuild_1.buildTag(dav, 'report')]: { [xBuild_1.buildTag(cal, 'calendar-multiget')]: '' } },
161
- { [xBuild_1.buildTag(dav, 'report')]: { [xBuild_1.buildTag(cal, 'sync-collection')]: '' } }
157
+ [(0, xBuild_1.buildTag)(dav, 'supported-report-set')]: {
158
+ [(0, xBuild_1.buildTag)(dav, 'supported-report')]: [
159
+ { [(0, xBuild_1.buildTag)(dav, 'report')]: { [(0, xBuild_1.buildTag)(cal, 'calendar-query')]: '' } },
160
+ { [(0, xBuild_1.buildTag)(dav, 'report')]: { [(0, xBuild_1.buildTag)(cal, 'calendar-multiget')]: '' } },
161
+ { [(0, xBuild_1.buildTag)(dav, 'report')]: { [(0, xBuild_1.buildTag)(cal, 'sync-collection')]: '' } }
162
162
  ]
163
163
  }
164
164
  };
@@ -170,7 +170,7 @@ function default_1(opts) {
170
170
  resp: async ({ response, calendar }) => {
171
171
  if (response === 'calendar') {
172
172
  return {
173
- [xBuild_1.buildTag(dav, 'sync-token')]: calendar.syncToken
173
+ [(0, xBuild_1.buildTag)(dav, 'sync-token')]: calendar.syncToken
174
174
  };
175
175
  }
176
176
  }
@@ -181,7 +181,7 @@ function default_1(opts) {
181
181
  doc: 'https://tools.ietf.org/html/rfc4791#section-9.6',
182
182
  resp: async ({ event, calendar }) => {
183
183
  return {
184
- [xBuild_1.buildTag(cal, 'calendar-data')]: buildICS(event, calendar)
184
+ [(0, xBuild_1.buildTag)(cal, 'calendar-data')]: buildICS(event, calendar)
185
185
  };
186
186
  }
187
187
  },
@@ -190,7 +190,7 @@ function default_1(opts) {
190
190
  resp: async ({ resource, ctx }) => {
191
191
  if (resource === 'principal') {
192
192
  return {
193
- [xBuild_1.buildTag(cal, 'calendar-home-set')]: xBuild_1.href(ctx.state.calendarHomeUrl)
193
+ [(0, xBuild_1.buildTag)(cal, 'calendar-home-set')]: (0, xBuild_1.href)(ctx.state.calendarHomeUrl)
194
194
  };
195
195
  }
196
196
  }
@@ -199,8 +199,8 @@ function default_1(opts) {
199
199
  doc: 'https://tools.ietf.org/html/rfc4791#section-5.2.2',
200
200
  resp: async ({ resource, ctx }) => {
201
201
  if (resource === 'calendarProppatch') {
202
- return xBuild_1.response(ctx.url, xBuild_1.status[403], [{
203
- [xBuild_1.buildTag(cal, 'calendar-timezone')]: ''
202
+ return (0, xBuild_1.response)(ctx.url, xBuild_1.status[403], [{
203
+ [(0, xBuild_1.buildTag)(cal, 'calendar-timezone')]: ''
204
204
  }]);
205
205
  }
206
206
  }
@@ -212,8 +212,8 @@ function default_1(opts) {
212
212
  doc: 'https://tools.ietf.org/id/draft-daboo-valarm-extensions-01.html#rfc.section.9',
213
213
  resp: async ({ resource, ctx }) => {
214
214
  if (resource === 'calCollectionProppatch') {
215
- return xBuild_1.response(ctx.url, xBuild_1.status[403], [{
216
- [xBuild_1.buildTag(cal, 'default-alarm-vevent-date')]: ''
215
+ return (0, xBuild_1.response)(ctx.url, xBuild_1.status[403], [{
216
+ [(0, xBuild_1.buildTag)(cal, 'default-alarm-vevent-date')]: ''
217
217
  }]);
218
218
  }
219
219
  }
@@ -222,8 +222,8 @@ function default_1(opts) {
222
222
  doc: 'https://tools.ietf.org/id/draft-daboo-valarm-extensions-01.html#rfc.section.9',
223
223
  resp: async ({ resource, ctx }) => {
224
224
  if (resource === 'calCollectionProppatch') {
225
- return xBuild_1.response(ctx.url, xBuild_1.status[403], [{
226
- [xBuild_1.buildTag(cal, 'default-alarm-vevent-datetime')]: ''
225
+ return (0, xBuild_1.response)(ctx.url, xBuild_1.status[403], [{
226
+ [(0, xBuild_1.buildTag)(cal, 'default-alarm-vevent-datetime')]: ''
227
227
  }]);
228
228
  }
229
229
  }
@@ -232,7 +232,7 @@ function default_1(opts) {
232
232
  doc: 'https://tools.ietf.org/html/rfc6638#section-2.2',
233
233
  resp: async () => {
234
234
  return {
235
- [xBuild_1.buildTag(cal, 'schedule-inbox-URL')]: xBuild_1.href('')
235
+ [(0, xBuild_1.buildTag)(cal, 'schedule-inbox-URL')]: (0, xBuild_1.href)('')
236
236
  };
237
237
  }
238
238
  },
@@ -240,7 +240,7 @@ function default_1(opts) {
240
240
  doc: 'https://tools.ietf.org/html/rfc6638#section-2.1',
241
241
  resp: async () => {
242
242
  return {
243
- [xBuild_1.buildTag(cal, 'schedule-outbox-URL')]: xBuild_1.href('')
243
+ [(0, xBuild_1.buildTag)(cal, 'schedule-outbox-URL')]: (0, xBuild_1.href)('')
244
244
  };
245
245
  }
246
246
  },
@@ -249,8 +249,8 @@ function default_1(opts) {
249
249
  resp: async ({ resource }) => {
250
250
  if (resource === 'calendar') {
251
251
  return {
252
- [xBuild_1.buildTag(cal, 'supported-calendar-component-set')]: {
253
- [xBuild_1.buildTag(cal, 'comp')]: {
252
+ [(0, xBuild_1.buildTag)(cal, 'supported-calendar-component-set')]: {
253
+ [(0, xBuild_1.buildTag)(cal, 'comp')]: {
254
254
  '@name': 'VEVENT'
255
255
  }
256
256
  }
@@ -265,7 +265,7 @@ function default_1(opts) {
265
265
  resp: async ({ resource }) => {
266
266
  if (resource === 'calendar') {
267
267
  return {
268
- [xBuild_1.buildTag(cs, 'allowed-sharing-modes')]: ''
268
+ [(0, xBuild_1.buildTag)(cs, 'allowed-sharing-modes')]: ''
269
269
  };
270
270
  }
271
271
  }
@@ -278,7 +278,7 @@ function default_1(opts) {
278
278
  resp: async ({ response, calendar }) => {
279
279
  if (response === 'calendar') {
280
280
  return {
281
- [xBuild_1.buildTag(cs, 'getctag')]: calendar.syncToken
281
+ [(0, xBuild_1.buildTag)(cs, 'getctag')]: calendar.syncToken
282
282
  };
283
283
  }
284
284
  }
@@ -292,12 +292,12 @@ function default_1(opts) {
292
292
  resp: async ({ response, ctx, calendar }) => {
293
293
  if (response === 'calendar') {
294
294
  return {
295
- [xBuild_1.buildTag(ical, 'calendar-color')]: calendar.color
295
+ [(0, xBuild_1.buildTag)(ical, 'calendar-color')]: calendar.color
296
296
  };
297
297
  }
298
298
  else if (response === 'calendarProppatch') {
299
299
  return response(ctx.url, xBuild_1.status[403], [{
300
- [xBuild_1.buildTag(ical, 'calendar-color')]: ''
300
+ [(0, xBuild_1.buildTag)(ical, 'calendar-color')]: ''
301
301
  }]);
302
302
  }
303
303
  }
@@ -305,8 +305,8 @@ function default_1(opts) {
305
305
  'calendar-order': {
306
306
  resp: async ({ resource, ctx }) => {
307
307
  if (resource === 'calCollectionProppatch' || resource === 'calendarProppatch') {
308
- return xBuild_1.response(ctx.url, xBuild_1.status[403], [{
309
- [xBuild_1.buildTag(ical, 'calendar-order')]: ''
308
+ return (0, xBuild_1.response)(ctx.url, xBuild_1.status[403], [{
309
+ [(0, xBuild_1.buildTag)(ical, 'calendar-order')]: ''
310
310
  }]);
311
311
  }
312
312
  }
@@ -323,11 +323,11 @@ function default_1(opts) {
323
323
  }
324
324
  const tagAction = tags[child.namespaceURI][child.localName];
325
325
  if (!tagAction) {
326
- log.debug(`Tag miss: ${xBuild_1.buildTag(child.namespaceURI, child.localName)}`);
326
+ log.debug(`Tag miss: ${(0, xBuild_1.buildTag)(child.namespaceURI, child.localName)}`);
327
327
  return null;
328
328
  }
329
329
  if (!tagAction.resp) {
330
- log.debug(`Tag no response: ${xBuild_1.buildTag(child.namespaceURI, child.localName)}`);
330
+ log.debug(`Tag no response: ${(0, xBuild_1.buildTag)(child.namespaceURI, child.localName)}`);
331
331
  return null;
332
332
  }
333
333
  return await tagAction.resp({ resource, ctx, calendar, event, text: child.textContent });
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const winston_1 = require("winston");
4
4
  function default_1(opts) {
5
- const logger = winston_1.createLogger({
5
+ const logger = (0, winston_1.createLogger)({
6
6
  level: opts.logLevel || 'debug',
7
7
  format: winston_1.format.combine(winston_1.format.colorize(), winston_1.format.timestamp({
8
8
  format: 'YYYY-MM-DD HH:mm:ss:SSS'
@@ -1,4 +1,4 @@
1
- declare type XmlElement = {
1
+ type XmlElement = {
2
2
  [tag: string]: any;
3
3
  };
4
4
  export declare const buildTag: (namespaceURI: string, localName: string) => string;
@@ -8,65 +8,73 @@ const xmlbuilder2_1 = require("xmlbuilder2");
8
8
  const xml_1 = require("./xml");
9
9
  const mapKeys_1 = __importDefault(require("lodash/mapKeys"));
10
10
  const nsMap = function () {
11
- return mapKeys_1.default(xml_1.namespaces, (v, k) => {
11
+ return (0, mapKeys_1.default)(xml_1.namespaces, (v, k) => {
12
12
  return `@xmlns:${k}`;
13
13
  });
14
14
  };
15
- exports.buildTag = function (namespaceURI, localName) {
15
+ const buildTag = function (namespaceURI, localName) {
16
16
  return `${xml_1.nsLookup[namespaceURI]}:${localName}`;
17
17
  };
18
- exports.href = function (url) {
19
- return { [exports.buildTag('DAV:', 'href')]: url };
18
+ exports.buildTag = buildTag;
19
+ const href = function (url) {
20
+ return { [(0, exports.buildTag)('DAV:', 'href')]: url };
20
21
  };
21
- exports.build = function (obj) {
22
- const doc = xmlbuilder2_1.create(obj, { version: '1.0', encoding: 'UTF-8', noDoubleEncoding: true });
22
+ exports.href = href;
23
+ const build = function (obj) {
24
+ const doc = (0, xmlbuilder2_1.create)(obj, { version: '1.0', encoding: 'UTF-8', noDoubleEncoding: true });
23
25
  return doc.end({ prettyPrint: true });
24
26
  };
25
- exports.multistatus = function (responses, other) {
27
+ exports.build = build;
28
+ const multistatus = function (responses, other) {
26
29
  const res = {
27
- [exports.buildTag('DAV:', 'multistatus')]: nsMap()
30
+ [(0, exports.buildTag)('DAV:', 'multistatus')]: nsMap()
28
31
  };
29
32
  if (responses === null || responses === void 0 ? void 0 : responses.length) {
30
- res[exports.buildTag('DAV:', 'multistatus')][exports.buildTag('DAV:', 'response')] = responses;
33
+ res[(0, exports.buildTag)('DAV:', 'multistatus')][(0, exports.buildTag)('DAV:', 'response')] = responses;
31
34
  }
32
35
  if (other) {
33
- res[exports.buildTag('DAV:', 'multistatus')] = Object.assign(res[exports.buildTag('DAV:', 'multistatus')], other);
36
+ res[(0, exports.buildTag)('DAV:', 'multistatus')] = Object.assign(res[(0, exports.buildTag)('DAV:', 'multistatus')], other);
34
37
  }
35
38
  return res;
36
39
  };
40
+ exports.multistatus = multistatus;
37
41
  exports.status = {
38
42
  200: 'HTTP/1.1 200 OK',
39
43
  403: 'HTTP/1.1 403 Forbidden',
40
44
  404: 'HTTP/1.1 404 Not Found'
41
45
  };
42
- exports.response = function (url, status, props) {
43
- const res = exports.href(url);
44
- res[exports.buildTag('DAV:', 'propstat')] = [{
45
- [exports.buildTag('DAV:', 'status')]: status
46
+ const response = function (url, status, props) {
47
+ const res = (0, exports.href)(url);
48
+ res[(0, exports.buildTag)('DAV:', 'propstat')] = [{
49
+ [(0, exports.buildTag)('DAV:', 'status')]: status
46
50
  }];
47
51
  if (props && props.length) {
48
- res[exports.buildTag('DAV:', 'propstat')][0][exports.buildTag('DAV:', 'prop')] = Object.assign({}, ...props);
52
+ res[(0, exports.buildTag)('DAV:', 'propstat')][0][(0, exports.buildTag)('DAV:', 'prop')] = Object.assign({}, ...props);
49
53
  }
50
54
  return res;
51
55
  };
52
- exports.missingPropstats = function (props) {
56
+ exports.response = response;
57
+ const missingPropstats = function (props) {
53
58
  return props.reduce((res, v) => {
54
- res[exports.buildTag('DAV:', 'prop')][v] = '';
59
+ res[(0, exports.buildTag)('DAV:', 'prop')][v] = '';
55
60
  return res;
56
61
  }, {
57
- [exports.buildTag('DAV:', 'status')]: exports.status[404],
58
- [exports.buildTag('DAV:', 'prop')]: {}
62
+ [(0, exports.buildTag)('DAV:', 'status')]: exports.status[404],
63
+ [(0, exports.buildTag)('DAV:', 'prop')]: {}
59
64
  });
60
65
  };
61
- exports.notFound = function (href) {
62
- return exports.build(exports.multistatus([exports.response(href, exports.status[404])]));
66
+ exports.missingPropstats = missingPropstats;
67
+ const notFound = function (href) {
68
+ return (0, exports.build)((0, exports.multistatus)([(0, exports.response)(href, exports.status[404])]));
63
69
  };
70
+ exports.notFound = notFound;
64
71
  /* https://tools.ietf.org/html/rfc4791#section-5.3.2.1 */
65
- exports.preconditionFail = function (url, reason) {
72
+ const preconditionFail = function (url, reason) {
66
73
  const res = {
67
74
  'D:error': Object.assign({
68
- [exports.buildTag('urn:ietf:params:xml:ns:caldav', reason)]: url
75
+ [(0, exports.buildTag)('urn:ietf:params:xml:ns:caldav', reason)]: url
69
76
  }, nsMap())
70
77
  };
71
- return exports.build(res);
78
+ return (0, exports.build)(res);
72
79
  };
80
+ exports.preconditionFail = preconditionFail;