caldav-adapter 4.3.1 → 5.0.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.
- package/.commitlintrc.js +3 -0
- package/.editorconfig +9 -0
- package/.gitattributes +1 -0
- package/.github/workflows/ci.yml +24 -0
- package/.husky/commit-msg +4 -0
- package/.husky/pre-commit +4 -0
- package/.lintstagedrc.js +5 -0
- package/.prettierrc.js +5 -0
- package/.remarkignore +1 -0
- package/.remarkrc.js +3 -0
- package/.xo-config.js +8 -0
- package/LICENSE +21 -0
- package/README.md +26 -240
- package/common/parse-body.js +16 -0
- package/common/response.js +51 -0
- package/common/tags.js +412 -0
- package/common/winston.js +32 -0
- package/common/x-build.js +109 -0
- package/common/xml.js +36 -0
- package/index.js +171 -0
- package/package.json +58 -40
- package/routes/calendar/calendar/calendar-multiget.js +48 -0
- package/routes/calendar/calendar/calendar-query.js +80 -0
- package/routes/calendar/calendar/delete.js +40 -0
- package/routes/calendar/calendar/event-response.js +37 -0
- package/routes/calendar/calendar/expand-property.js +11 -0
- package/routes/calendar/calendar/get.js +27 -0
- package/routes/calendar/calendar/propfind.js +73 -0
- package/routes/calendar/calendar/proppatch.js +32 -0
- package/routes/calendar/calendar/put.js +76 -0
- package/routes/calendar/calendar/report.js +36 -0
- package/routes/calendar/calendar/sync-collection.js +36 -0
- package/routes/calendar/calendar.js +80 -0
- package/routes/calendar/user/propfind.js +60 -0
- package/routes/calendar/user/proppatch.js +31 -0
- package/routes/principal/principal.js +31 -0
- package/routes/principal/propfind.js +32 -0
- package/routes/principal/report.js +27 -0
- package/test/test.js +8 -0
- package/lib/common/date.d.ts +0 -2
- package/lib/common/date.js +0 -11
- package/lib/common/eventBuild.d.ts +0 -6
- package/lib/common/eventBuild.js +0 -170
- package/lib/common/parseBody.d.ts +0 -2
- package/lib/common/parseBody.js +0 -21
- package/lib/common/response.d.ts +0 -6
- package/lib/common/response.js +0 -53
- package/lib/common/tags.d.ts +0 -263
- package/lib/common/tags.js +0 -337
- package/lib/common/winston.d.ts +0 -11
- package/lib/common/winston.js +0 -26
- package/lib/common/xBuild.d.ts +0 -17
- package/lib/common/xBuild.js +0 -80
- package/lib/common/xml.d.ts +0 -17
- package/lib/common/xml.js +0 -30
- package/lib/index.d.ts +0 -143
- package/lib/index.js +0 -8
- package/lib/koa.d.ts +0 -21
- package/lib/koa.js +0 -130
- package/lib/routes/calendar/calendar/calendar-multiget.d.ts +0 -7
- package/lib/routes/calendar/calendar/calendar-multiget.js +0 -68
- package/lib/routes/calendar/calendar/calendar-query.d.ts +0 -7
- package/lib/routes/calendar/calendar/calendar-query.js +0 -68
- package/lib/routes/calendar/calendar/delete.d.ts +0 -5
- package/lib/routes/calendar/calendar/delete.js +0 -40
- package/lib/routes/calendar/calendar/eventResponse.d.ts +0 -7
- package/lib/routes/calendar/calendar/eventResponse.js +0 -36
- package/lib/routes/calendar/calendar/expand-property.d.ts +0 -7
- package/lib/routes/calendar/calendar/expand-property.js +0 -15
- package/lib/routes/calendar/calendar/get.d.ts +0 -5
- package/lib/routes/calendar/calendar/get.js +0 -30
- package/lib/routes/calendar/calendar/propfind.d.ts +0 -8
- package/lib/routes/calendar/calendar/propfind.js +0 -76
- package/lib/routes/calendar/calendar/proppatch.d.ts +0 -5
- package/lib/routes/calendar/calendar/proppatch.js +0 -53
- package/lib/routes/calendar/calendar/put.d.ts +0 -5
- package/lib/routes/calendar/calendar/put.js +0 -68
- package/lib/routes/calendar/calendar/report.d.ts +0 -5
- package/lib/routes/calendar/calendar/report.js +0 -39
- package/lib/routes/calendar/calendar/sync-collection.d.ts +0 -10
- package/lib/routes/calendar/calendar/sync-collection.js +0 -57
- package/lib/routes/calendar/calendar.d.ts +0 -3
- package/lib/routes/calendar/calendar.js +0 -78
- package/lib/routes/calendar/user/propfind.d.ts +0 -5
- package/lib/routes/calendar/user/propfind.js +0 -64
- package/lib/routes/calendar/user/proppatch.d.ts +0 -5
- package/lib/routes/calendar/user/proppatch.js +0 -52
- package/lib/routes/principal/principal.d.ts +0 -3
- package/lib/routes/principal/principal.js +0 -32
- package/lib/routes/principal/propfind.d.ts +0 -3
- package/lib/routes/principal/propfind.js +0 -50
- package/lib/routes/principal/report.d.ts +0 -3
- package/lib/routes/principal/report.js +0 -32
package/lib/common/response.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.setMissingMethod = exports.setEventPutResponse = exports.setMultistatusResponse = exports.setOptions = void 0;
|
|
4
|
-
const setAllowHeader = function (ctx, methods) {
|
|
5
|
-
ctx.set('Allow', methods.join(', '));
|
|
6
|
-
};
|
|
7
|
-
const setDAVHeader = function (ctx) {
|
|
8
|
-
ctx.set('DAV', [
|
|
9
|
-
'1',
|
|
10
|
-
// '2',
|
|
11
|
-
'3',
|
|
12
|
-
// 'extended-mkcol',
|
|
13
|
-
'calendar-access',
|
|
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'
|
|
23
|
-
].join(', '));
|
|
24
|
-
};
|
|
25
|
-
const setXMLHeader = function (ctx) {
|
|
26
|
-
ctx.set('Content-Type', 'application/xml; charset="utf-8"');
|
|
27
|
-
};
|
|
28
|
-
/* https://tools.ietf.org/html/rfc4791#section-5.1.1 */
|
|
29
|
-
const setOptions = function (ctx, methods) {
|
|
30
|
-
ctx.status = 200;
|
|
31
|
-
setAllowHeader(ctx, methods);
|
|
32
|
-
setDAVHeader(ctx);
|
|
33
|
-
ctx.body = '';
|
|
34
|
-
};
|
|
35
|
-
exports.setOptions = setOptions;
|
|
36
|
-
/* https://tools.ietf.org/html/rfc4791#section-7.8.1 */
|
|
37
|
-
const setMultistatusResponse = function (ctx) {
|
|
38
|
-
ctx.status = 207;
|
|
39
|
-
setDAVHeader(ctx);
|
|
40
|
-
setXMLHeader(ctx);
|
|
41
|
-
};
|
|
42
|
-
exports.setMultistatusResponse = setMultistatusResponse;
|
|
43
|
-
/* https://tools.ietf.org/html/rfc4791#section-5.3.2 */
|
|
44
|
-
const setEventPutResponse = function (ctx, event) {
|
|
45
|
-
ctx.status = 201;
|
|
46
|
-
ctx.set('ETag', event.lastModifiedOn);
|
|
47
|
-
};
|
|
48
|
-
exports.setEventPutResponse = setEventPutResponse;
|
|
49
|
-
const setMissingMethod = function (ctx) {
|
|
50
|
-
ctx.status = 404;
|
|
51
|
-
ctx.set('Content-Type', 'text/html; charset="utf-8"');
|
|
52
|
-
};
|
|
53
|
-
exports.setMissingMethod = setMissingMethod;
|
package/lib/common/tags.d.ts
DELETED
|
@@ -1,263 +0,0 @@
|
|
|
1
|
-
import { CalendarContext } from '../koa';
|
|
2
|
-
import { CalDavCalendar, CalDavEvent } from '..';
|
|
3
|
-
export default function (opts: any): {
|
|
4
|
-
tags: {
|
|
5
|
-
readonly "DAV:": {
|
|
6
|
-
readonly 'current-user-principal': {
|
|
7
|
-
readonly doc: "https://tools.ietf.org/html/rfc5397#section-3";
|
|
8
|
-
readonly resp: ({ ctx }: {
|
|
9
|
-
ctx: any;
|
|
10
|
-
}) => Promise<{
|
|
11
|
-
[x: string]: {
|
|
12
|
-
[tag: string]: any;
|
|
13
|
-
};
|
|
14
|
-
}>;
|
|
15
|
-
};
|
|
16
|
-
readonly 'current-user-privilege-set': {
|
|
17
|
-
readonly doc: "https://tools.ietf.org/html/rfc3744#section-5.4";
|
|
18
|
-
readonly resp: ({ resource, calendar }: {
|
|
19
|
-
resource: any;
|
|
20
|
-
calendar: any;
|
|
21
|
-
}) => Promise<{
|
|
22
|
-
[x: string]: {
|
|
23
|
-
[x: string]: {
|
|
24
|
-
[x: string]: string;
|
|
25
|
-
}[];
|
|
26
|
-
};
|
|
27
|
-
}>;
|
|
28
|
-
};
|
|
29
|
-
readonly displayname: {
|
|
30
|
-
readonly doc: "https://tools.ietf.org/html/rfc4918#section-15.2";
|
|
31
|
-
readonly resp: ({ resource, ctx, calendar }: {
|
|
32
|
-
resource: any;
|
|
33
|
-
ctx: any;
|
|
34
|
-
calendar: any;
|
|
35
|
-
}) => Promise<{
|
|
36
|
-
[x: string]: any;
|
|
37
|
-
}>;
|
|
38
|
-
};
|
|
39
|
-
readonly getcontenttype: {
|
|
40
|
-
readonly doc: "https://tools.ietf.org/html/rfc2518#section-13.5";
|
|
41
|
-
readonly resp: ({ resource }: {
|
|
42
|
-
resource: any;
|
|
43
|
-
}) => Promise<{
|
|
44
|
-
[x: string]: string;
|
|
45
|
-
}>;
|
|
46
|
-
};
|
|
47
|
-
readonly getetag: {
|
|
48
|
-
readonly doc: "https://tools.ietf.org/html/rfc4791#section-5.3.4";
|
|
49
|
-
readonly resp: ({ resource, event }: {
|
|
50
|
-
resource: any;
|
|
51
|
-
event: any;
|
|
52
|
-
}) => Promise<{
|
|
53
|
-
[x: string]: any;
|
|
54
|
-
}>;
|
|
55
|
-
};
|
|
56
|
-
readonly owner: {
|
|
57
|
-
readonly doc: "https://tools.ietf.org/html/rfc3744#section-5.1";
|
|
58
|
-
readonly resp: ({ resource, ctx }: {
|
|
59
|
-
resource: any;
|
|
60
|
-
ctx: any;
|
|
61
|
-
}) => Promise<{
|
|
62
|
-
[x: string]: {
|
|
63
|
-
[tag: string]: any;
|
|
64
|
-
};
|
|
65
|
-
}>;
|
|
66
|
-
};
|
|
67
|
-
readonly 'principal-collection-set': {
|
|
68
|
-
readonly doc: "https://tools.ietf.org/html/rfc3744#section-5.8";
|
|
69
|
-
readonly resp: ({ resource, ctx }: {
|
|
70
|
-
resource: any;
|
|
71
|
-
ctx: any;
|
|
72
|
-
}) => Promise<{
|
|
73
|
-
[x: string]: {
|
|
74
|
-
[tag: string]: any;
|
|
75
|
-
};
|
|
76
|
-
}>;
|
|
77
|
-
};
|
|
78
|
-
readonly 'principal-URL': {
|
|
79
|
-
readonly doc: "https://tools.ietf.org/html/rfc3744#section-4.2";
|
|
80
|
-
readonly resp: ({ ctx }: {
|
|
81
|
-
ctx: any;
|
|
82
|
-
}) => Promise<{
|
|
83
|
-
[x: string]: {
|
|
84
|
-
[tag: string]: any;
|
|
85
|
-
};
|
|
86
|
-
}>;
|
|
87
|
-
};
|
|
88
|
-
readonly 'resource-id': {
|
|
89
|
-
readonly doc: "https://tools.ietf.org/html/rfc5842#section-3.1";
|
|
90
|
-
};
|
|
91
|
-
readonly resourcetype: {
|
|
92
|
-
readonly doc: "https://tools.ietf.org/html/rfc4791#section-4.2";
|
|
93
|
-
readonly resp: ({ resource }: {
|
|
94
|
-
resource: any;
|
|
95
|
-
}) => Promise<{
|
|
96
|
-
[x: string]: {
|
|
97
|
-
[x: string]: string;
|
|
98
|
-
};
|
|
99
|
-
}>;
|
|
100
|
-
};
|
|
101
|
-
readonly 'supported-report-set': {
|
|
102
|
-
readonly doc: "https://tools.ietf.org/html/rfc3253#section-3.1.5";
|
|
103
|
-
readonly resp: ({ resource }: {
|
|
104
|
-
resource: any;
|
|
105
|
-
}) => Promise<{
|
|
106
|
-
[x: string]: {
|
|
107
|
-
[x: string]: {
|
|
108
|
-
[x: string]: {
|
|
109
|
-
[x: string]: string;
|
|
110
|
-
};
|
|
111
|
-
};
|
|
112
|
-
};
|
|
113
|
-
} | {
|
|
114
|
-
[x: string]: {
|
|
115
|
-
[x: string]: {
|
|
116
|
-
[x: string]: {
|
|
117
|
-
[x: string]: string;
|
|
118
|
-
};
|
|
119
|
-
}[];
|
|
120
|
-
};
|
|
121
|
-
}>;
|
|
122
|
-
};
|
|
123
|
-
readonly 'sync-token': {
|
|
124
|
-
readonly doc: "https://tools.ietf.org/html/rfc6578#section-3";
|
|
125
|
-
readonly resp: ({ response, calendar }: {
|
|
126
|
-
response: any;
|
|
127
|
-
calendar: any;
|
|
128
|
-
}) => Promise<{
|
|
129
|
-
[x: string]: any;
|
|
130
|
-
}>;
|
|
131
|
-
};
|
|
132
|
-
};
|
|
133
|
-
readonly "urn:ietf:params:xml:ns:caldav": {
|
|
134
|
-
readonly 'calendar-data': {
|
|
135
|
-
readonly doc: "https://tools.ietf.org/html/rfc4791#section-9.6";
|
|
136
|
-
readonly resp: ({ event, calendar }: {
|
|
137
|
-
event: any;
|
|
138
|
-
calendar: any;
|
|
139
|
-
}) => Promise<{
|
|
140
|
-
[x: string]: string;
|
|
141
|
-
}>;
|
|
142
|
-
};
|
|
143
|
-
readonly 'calendar-home-set': {
|
|
144
|
-
readonly doc: "https://tools.ietf.org/html/rfc4791#section-6.2.1";
|
|
145
|
-
readonly resp: ({ resource, ctx }: {
|
|
146
|
-
resource: any;
|
|
147
|
-
ctx: any;
|
|
148
|
-
}) => Promise<{
|
|
149
|
-
[x: string]: {
|
|
150
|
-
[tag: string]: any;
|
|
151
|
-
};
|
|
152
|
-
}>;
|
|
153
|
-
};
|
|
154
|
-
readonly 'calendar-timezone': {
|
|
155
|
-
readonly doc: "https://tools.ietf.org/html/rfc4791#section-5.2.2";
|
|
156
|
-
readonly resp: ({ resource, ctx }: {
|
|
157
|
-
resource: any;
|
|
158
|
-
ctx: any;
|
|
159
|
-
}) => Promise<{
|
|
160
|
-
[tag: string]: any;
|
|
161
|
-
}>;
|
|
162
|
-
};
|
|
163
|
-
readonly 'calendar-user-address-set': {
|
|
164
|
-
readonly doc: "https://tools.ietf.org/html/rfc6638#section-2.4.1";
|
|
165
|
-
};
|
|
166
|
-
readonly 'default-alarm-vevent-date': {
|
|
167
|
-
readonly doc: "https://tools.ietf.org/id/draft-daboo-valarm-extensions-01.html#rfc.section.9";
|
|
168
|
-
readonly resp: ({ resource, ctx }: {
|
|
169
|
-
resource: any;
|
|
170
|
-
ctx: any;
|
|
171
|
-
}) => Promise<{
|
|
172
|
-
[tag: string]: any;
|
|
173
|
-
}>;
|
|
174
|
-
};
|
|
175
|
-
readonly 'default-alarm-vevent-datetime': {
|
|
176
|
-
readonly doc: "https://tools.ietf.org/id/draft-daboo-valarm-extensions-01.html#rfc.section.9";
|
|
177
|
-
readonly resp: ({ resource, ctx }: {
|
|
178
|
-
resource: any;
|
|
179
|
-
ctx: any;
|
|
180
|
-
}) => Promise<{
|
|
181
|
-
[tag: string]: any;
|
|
182
|
-
}>;
|
|
183
|
-
};
|
|
184
|
-
readonly 'schedule-inbox-URL': {
|
|
185
|
-
readonly doc: "https://tools.ietf.org/html/rfc6638#section-2.2";
|
|
186
|
-
readonly resp: () => Promise<{
|
|
187
|
-
[x: string]: {
|
|
188
|
-
[tag: string]: any;
|
|
189
|
-
};
|
|
190
|
-
}>;
|
|
191
|
-
};
|
|
192
|
-
readonly 'schedule-outbox-URL': {
|
|
193
|
-
readonly doc: "https://tools.ietf.org/html/rfc6638#section-2.1";
|
|
194
|
-
readonly resp: () => Promise<{
|
|
195
|
-
[x: string]: {
|
|
196
|
-
[tag: string]: any;
|
|
197
|
-
};
|
|
198
|
-
}>;
|
|
199
|
-
};
|
|
200
|
-
readonly 'supported-calendar-component-set': {
|
|
201
|
-
readonly doc: "https://tools.ietf.org/html/rfc4791#section-5.2.3";
|
|
202
|
-
readonly resp: ({ resource }: {
|
|
203
|
-
resource: any;
|
|
204
|
-
}) => Promise<{
|
|
205
|
-
[x: string]: {
|
|
206
|
-
[x: string]: {
|
|
207
|
-
'@name': string;
|
|
208
|
-
};
|
|
209
|
-
};
|
|
210
|
-
}>;
|
|
211
|
-
};
|
|
212
|
-
};
|
|
213
|
-
readonly "http://calendarserver.org/ns/": {
|
|
214
|
-
readonly 'allowed-sharing-modes': {
|
|
215
|
-
readonly doc: "https://github.com/apple/ccs-calendarserver/blob/master/doc/Extensions/caldav-sharing.txt";
|
|
216
|
-
readonly resp: ({ resource }: {
|
|
217
|
-
resource: any;
|
|
218
|
-
}) => Promise<{
|
|
219
|
-
[x: string]: string;
|
|
220
|
-
}>;
|
|
221
|
-
};
|
|
222
|
-
readonly 'checksum-versions': {};
|
|
223
|
-
readonly 'dropbox-home-URL': {};
|
|
224
|
-
readonly 'email-address-set': {};
|
|
225
|
-
readonly getctag: {
|
|
226
|
-
readonly doc: "https://github.com/apple/ccs-calendarserver/blob/master/doc/Extensions/caldav-ctag.txt";
|
|
227
|
-
readonly resp: ({ response, calendar }: {
|
|
228
|
-
response: any;
|
|
229
|
-
calendar: any;
|
|
230
|
-
}) => Promise<{
|
|
231
|
-
[x: string]: any;
|
|
232
|
-
}>;
|
|
233
|
-
};
|
|
234
|
-
readonly 'notification-URL': {
|
|
235
|
-
readonly doc: "https://github.com/apple/ccs-calendarserver/blob/master/doc/Extensions/caldav-notifications.txt";
|
|
236
|
-
};
|
|
237
|
-
};
|
|
238
|
-
readonly "http://apple.com/ns/ical/": {
|
|
239
|
-
readonly 'calendar-color': {
|
|
240
|
-
readonly resp: ({ response, ctx, calendar }: {
|
|
241
|
-
response: any;
|
|
242
|
-
ctx: any;
|
|
243
|
-
calendar: any;
|
|
244
|
-
}) => Promise<any>;
|
|
245
|
-
};
|
|
246
|
-
readonly 'calendar-order': {
|
|
247
|
-
readonly resp: ({ resource, ctx }: {
|
|
248
|
-
resource: any;
|
|
249
|
-
ctx: any;
|
|
250
|
-
}) => Promise<{
|
|
251
|
-
[tag: string]: any;
|
|
252
|
-
}>;
|
|
253
|
-
};
|
|
254
|
-
};
|
|
255
|
-
};
|
|
256
|
-
getResponse: ({ resource, child, ctx, calendar, event }: {
|
|
257
|
-
resource: string;
|
|
258
|
-
child: Element;
|
|
259
|
-
ctx: CalendarContext;
|
|
260
|
-
calendar?: CalDavCalendar;
|
|
261
|
-
event?: CalDavEvent;
|
|
262
|
-
}) => Promise<any>;
|
|
263
|
-
};
|
package/lib/common/tags.js
DELETED
|
@@ -1,337 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const xBuild_1 = require("./xBuild");
|
|
7
|
-
const winston_1 = __importDefault(require("./winston"));
|
|
8
|
-
const eventBuild_1 = __importDefault(require("./eventBuild"));
|
|
9
|
-
const dav = 'DAV:';
|
|
10
|
-
const cal = 'urn:ietf:params:xml:ns:caldav';
|
|
11
|
-
const cs = 'http://calendarserver.org/ns/';
|
|
12
|
-
const ical = 'http://apple.com/ns/ical/';
|
|
13
|
-
function default_1(opts) {
|
|
14
|
-
const log = (0, winston_1.default)(Object.assign(Object.assign({}, opts), { label: 'tags' }));
|
|
15
|
-
const { buildICS } = (0, eventBuild_1.default)(opts);
|
|
16
|
-
const tags = {
|
|
17
|
-
[dav]: {
|
|
18
|
-
'current-user-principal': {
|
|
19
|
-
doc: 'https://tools.ietf.org/html/rfc5397#section-3',
|
|
20
|
-
resp: async ({ ctx }) => {
|
|
21
|
-
return {
|
|
22
|
-
[(0, xBuild_1.buildTag)(dav, 'current-user-principal')]: (0, xBuild_1.href)(ctx.state.principalUrl)
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
'current-user-privilege-set': {
|
|
27
|
-
doc: 'https://tools.ietf.org/html/rfc3744#section-5.4',
|
|
28
|
-
resp: async ({ resource, calendar }) => {
|
|
29
|
-
if (resource === 'calendar') {
|
|
30
|
-
const privileges = [{ [(0, xBuild_1.buildTag)(dav, 'read')]: '' }];
|
|
31
|
-
if (!calendar.readOnly) {
|
|
32
|
-
privileges.push(...[
|
|
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
|
-
]);
|
|
43
|
-
}
|
|
44
|
-
return {
|
|
45
|
-
[(0, xBuild_1.buildTag)(dav, 'current-user-privilege-set')]: {
|
|
46
|
-
[(0, xBuild_1.buildTag)(dav, 'privilege')]: privileges
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
displayname: {
|
|
53
|
-
doc: 'https://tools.ietf.org/html/rfc4918#section-15.2',
|
|
54
|
-
resp: async ({ resource, ctx, calendar }) => {
|
|
55
|
-
if (resource === 'principal') {
|
|
56
|
-
return {
|
|
57
|
-
[(0, xBuild_1.buildTag)(dav, 'displayname')]: ctx.state.user.principalName
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
else if (resource === 'calendar') {
|
|
61
|
-
return {
|
|
62
|
-
[(0, xBuild_1.buildTag)(dav, 'displayname')]: calendar.calendarName
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
getcontenttype: {
|
|
68
|
-
doc: 'https://tools.ietf.org/html/rfc2518#section-13.5',
|
|
69
|
-
resp: async ({ resource }) => {
|
|
70
|
-
if (resource === 'calendar') {
|
|
71
|
-
return {
|
|
72
|
-
[(0, xBuild_1.buildTag)(dav, 'getcontenttype')]: 'text/calendar; charset=utf-8; component=VEVENT'
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
else if (resource === 'event') {
|
|
76
|
-
return {
|
|
77
|
-
[(0, xBuild_1.buildTag)(dav, 'getcontenttype')]: 'text/calendar; charset=utf-8; component=VEVENT'
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
getetag: {
|
|
83
|
-
doc: 'https://tools.ietf.org/html/rfc4791#section-5.3.4',
|
|
84
|
-
resp: async ({ resource, event }) => {
|
|
85
|
-
if (resource === 'event') {
|
|
86
|
-
return {
|
|
87
|
-
[(0, xBuild_1.buildTag)(dav, 'getetag')]: event.lastModifiedOn
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
owner: {
|
|
93
|
-
doc: 'https://tools.ietf.org/html/rfc3744#section-5.1',
|
|
94
|
-
resp: async ({ resource, ctx }) => {
|
|
95
|
-
if (resource === 'calendar') {
|
|
96
|
-
return {
|
|
97
|
-
[(0, xBuild_1.buildTag)(dav, 'owner')]: (0, xBuild_1.href)(ctx.state.principalUrl)
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
|
-
'principal-collection-set': {
|
|
103
|
-
doc: 'https://tools.ietf.org/html/rfc3744#section-5.8',
|
|
104
|
-
resp: async ({ resource, ctx }) => {
|
|
105
|
-
if (resource === 'principal') {
|
|
106
|
-
return {
|
|
107
|
-
[(0, xBuild_1.buildTag)(dav, 'principal-collection-set')]: (0, xBuild_1.href)(ctx.state.principalRootUrl)
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
},
|
|
112
|
-
'principal-URL': {
|
|
113
|
-
doc: 'https://tools.ietf.org/html/rfc3744#section-4.2',
|
|
114
|
-
resp: async ({ ctx }) => {
|
|
115
|
-
return {
|
|
116
|
-
[(0, xBuild_1.buildTag)(dav, 'principal-URL')]: (0, xBuild_1.href)(ctx.state.principalUrl)
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
},
|
|
120
|
-
'resource-id': {
|
|
121
|
-
doc: 'https://tools.ietf.org/html/rfc5842#section-3.1'
|
|
122
|
-
},
|
|
123
|
-
resourcetype: {
|
|
124
|
-
doc: 'https://tools.ietf.org/html/rfc4791#section-4.2',
|
|
125
|
-
resp: async ({ resource }) => {
|
|
126
|
-
if (resource === 'calCollection') {
|
|
127
|
-
return {
|
|
128
|
-
[(0, xBuild_1.buildTag)(dav, 'resourcetype')]: {
|
|
129
|
-
[(0, xBuild_1.buildTag)(dav, 'collection')]: ''
|
|
130
|
-
}
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
else if (resource === 'calendar') {
|
|
134
|
-
return {
|
|
135
|
-
[(0, xBuild_1.buildTag)(dav, 'resourcetype')]: {
|
|
136
|
-
[(0, xBuild_1.buildTag)(dav, 'collection')]: '',
|
|
137
|
-
[(0, xBuild_1.buildTag)(cal, 'calendar')]: ''
|
|
138
|
-
}
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
},
|
|
143
|
-
'supported-report-set': {
|
|
144
|
-
doc: 'https://tools.ietf.org/html/rfc3253#section-3.1.5',
|
|
145
|
-
resp: async ({ resource }) => {
|
|
146
|
-
if (resource === 'calCollection') {
|
|
147
|
-
return {
|
|
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
|
-
}
|
|
152
|
-
}
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
else if (resource === 'calendar') {
|
|
156
|
-
return {
|
|
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
|
-
]
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
},
|
|
168
|
-
'sync-token': {
|
|
169
|
-
doc: 'https://tools.ietf.org/html/rfc6578#section-3',
|
|
170
|
-
resp: async ({ response, calendar }) => {
|
|
171
|
-
if (response === 'calendar') {
|
|
172
|
-
return {
|
|
173
|
-
[(0, xBuild_1.buildTag)(dav, 'sync-token')]: calendar.syncToken
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
},
|
|
179
|
-
[cal]: {
|
|
180
|
-
'calendar-data': {
|
|
181
|
-
doc: 'https://tools.ietf.org/html/rfc4791#section-9.6',
|
|
182
|
-
resp: async ({ event, calendar }) => {
|
|
183
|
-
return {
|
|
184
|
-
[(0, xBuild_1.buildTag)(cal, 'calendar-data')]: buildICS(event, calendar)
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
},
|
|
188
|
-
'calendar-home-set': {
|
|
189
|
-
doc: 'https://tools.ietf.org/html/rfc4791#section-6.2.1',
|
|
190
|
-
resp: async ({ resource, ctx }) => {
|
|
191
|
-
if (resource === 'principal') {
|
|
192
|
-
return {
|
|
193
|
-
[(0, xBuild_1.buildTag)(cal, 'calendar-home-set')]: (0, xBuild_1.href)(ctx.state.calendarHomeUrl)
|
|
194
|
-
};
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
},
|
|
198
|
-
'calendar-timezone': {
|
|
199
|
-
doc: 'https://tools.ietf.org/html/rfc4791#section-5.2.2',
|
|
200
|
-
resp: async ({ resource, ctx }) => {
|
|
201
|
-
if (resource === 'calendarProppatch') {
|
|
202
|
-
return (0, xBuild_1.response)(ctx.url, xBuild_1.status[403], [{
|
|
203
|
-
[(0, xBuild_1.buildTag)(cal, 'calendar-timezone')]: ''
|
|
204
|
-
}]);
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
},
|
|
208
|
-
'calendar-user-address-set': {
|
|
209
|
-
doc: 'https://tools.ietf.org/html/rfc6638#section-2.4.1'
|
|
210
|
-
},
|
|
211
|
-
'default-alarm-vevent-date': {
|
|
212
|
-
doc: 'https://tools.ietf.org/id/draft-daboo-valarm-extensions-01.html#rfc.section.9',
|
|
213
|
-
resp: async ({ resource, ctx }) => {
|
|
214
|
-
if (resource === 'calCollectionProppatch') {
|
|
215
|
-
return (0, xBuild_1.response)(ctx.url, xBuild_1.status[403], [{
|
|
216
|
-
[(0, xBuild_1.buildTag)(cal, 'default-alarm-vevent-date')]: ''
|
|
217
|
-
}]);
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
},
|
|
221
|
-
'default-alarm-vevent-datetime': {
|
|
222
|
-
doc: 'https://tools.ietf.org/id/draft-daboo-valarm-extensions-01.html#rfc.section.9',
|
|
223
|
-
resp: async ({ resource, ctx }) => {
|
|
224
|
-
if (resource === 'calCollectionProppatch') {
|
|
225
|
-
return (0, xBuild_1.response)(ctx.url, xBuild_1.status[403], [{
|
|
226
|
-
[(0, xBuild_1.buildTag)(cal, 'default-alarm-vevent-datetime')]: ''
|
|
227
|
-
}]);
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
},
|
|
231
|
-
'schedule-inbox-URL': {
|
|
232
|
-
doc: 'https://tools.ietf.org/html/rfc6638#section-2.2',
|
|
233
|
-
resp: async () => {
|
|
234
|
-
return {
|
|
235
|
-
[(0, xBuild_1.buildTag)(cal, 'schedule-inbox-URL')]: (0, xBuild_1.href)('')
|
|
236
|
-
};
|
|
237
|
-
}
|
|
238
|
-
},
|
|
239
|
-
'schedule-outbox-URL': {
|
|
240
|
-
doc: 'https://tools.ietf.org/html/rfc6638#section-2.1',
|
|
241
|
-
resp: async () => {
|
|
242
|
-
return {
|
|
243
|
-
[(0, xBuild_1.buildTag)(cal, 'schedule-outbox-URL')]: (0, xBuild_1.href)('')
|
|
244
|
-
};
|
|
245
|
-
}
|
|
246
|
-
},
|
|
247
|
-
'supported-calendar-component-set': {
|
|
248
|
-
doc: 'https://tools.ietf.org/html/rfc4791#section-5.2.3',
|
|
249
|
-
resp: async ({ resource }) => {
|
|
250
|
-
if (resource === 'calendar') {
|
|
251
|
-
return {
|
|
252
|
-
[(0, xBuild_1.buildTag)(cal, 'supported-calendar-component-set')]: {
|
|
253
|
-
[(0, xBuild_1.buildTag)(cal, 'comp')]: {
|
|
254
|
-
'@name': 'VEVENT'
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
};
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
},
|
|
262
|
-
[cs]: {
|
|
263
|
-
'allowed-sharing-modes': {
|
|
264
|
-
doc: 'https://github.com/apple/ccs-calendarserver/blob/master/doc/Extensions/caldav-sharing.txt',
|
|
265
|
-
resp: async ({ resource }) => {
|
|
266
|
-
if (resource === 'calendar') {
|
|
267
|
-
return {
|
|
268
|
-
[(0, xBuild_1.buildTag)(cs, 'allowed-sharing-modes')]: ''
|
|
269
|
-
};
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
},
|
|
273
|
-
'checksum-versions': {},
|
|
274
|
-
'dropbox-home-URL': {},
|
|
275
|
-
'email-address-set': {},
|
|
276
|
-
getctag: {
|
|
277
|
-
doc: 'https://github.com/apple/ccs-calendarserver/blob/master/doc/Extensions/caldav-ctag.txt',
|
|
278
|
-
resp: async ({ response, calendar }) => {
|
|
279
|
-
if (response === 'calendar') {
|
|
280
|
-
return {
|
|
281
|
-
[(0, xBuild_1.buildTag)(cs, 'getctag')]: calendar.syncToken
|
|
282
|
-
};
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
},
|
|
286
|
-
'notification-URL': {
|
|
287
|
-
doc: 'https://github.com/apple/ccs-calendarserver/blob/master/doc/Extensions/caldav-notifications.txt'
|
|
288
|
-
}
|
|
289
|
-
},
|
|
290
|
-
[ical]: {
|
|
291
|
-
'calendar-color': {
|
|
292
|
-
resp: async ({ response, ctx, calendar }) => {
|
|
293
|
-
if (response === 'calendar') {
|
|
294
|
-
return {
|
|
295
|
-
[(0, xBuild_1.buildTag)(ical, 'calendar-color')]: calendar.color
|
|
296
|
-
};
|
|
297
|
-
}
|
|
298
|
-
else if (response === 'calendarProppatch') {
|
|
299
|
-
return response(ctx.url, xBuild_1.status[403], [{
|
|
300
|
-
[(0, xBuild_1.buildTag)(ical, 'calendar-color')]: ''
|
|
301
|
-
}]);
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
},
|
|
305
|
-
'calendar-order': {
|
|
306
|
-
resp: async ({ resource, ctx }) => {
|
|
307
|
-
if (resource === 'calCollectionProppatch' || resource === 'calendarProppatch') {
|
|
308
|
-
return (0, xBuild_1.response)(ctx.url, xBuild_1.status[403], [{
|
|
309
|
-
[(0, xBuild_1.buildTag)(ical, 'calendar-order')]: ''
|
|
310
|
-
}]);
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
};
|
|
316
|
-
const getResponse = async ({ resource, child, ctx, calendar, event }) => {
|
|
317
|
-
if (!child.namespaceURI) {
|
|
318
|
-
return null;
|
|
319
|
-
}
|
|
320
|
-
if (!tags[child.namespaceURI]) {
|
|
321
|
-
log.debug(`Namespace miss: ${child.namespaceURI}`);
|
|
322
|
-
return null;
|
|
323
|
-
}
|
|
324
|
-
const tagAction = tags[child.namespaceURI][child.localName];
|
|
325
|
-
if (!tagAction) {
|
|
326
|
-
log.debug(`Tag miss: ${(0, xBuild_1.buildTag)(child.namespaceURI, child.localName)}`);
|
|
327
|
-
return null;
|
|
328
|
-
}
|
|
329
|
-
if (!tagAction.resp) {
|
|
330
|
-
log.debug(`Tag no response: ${(0, xBuild_1.buildTag)(child.namespaceURI, child.localName)}`);
|
|
331
|
-
return null;
|
|
332
|
-
}
|
|
333
|
-
return await tagAction.resp({ resource, ctx, calendar, event, text: child.textContent });
|
|
334
|
-
};
|
|
335
|
-
return { tags, getResponse };
|
|
336
|
-
}
|
|
337
|
-
exports.default = default_1;
|
package/lib/common/winston.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Logger } from 'winston';
|
|
2
|
-
import { CalDavOptionsLogging } from '..';
|
|
3
|
-
interface CalDavLogger extends Logger {
|
|
4
|
-
morganStream?: {
|
|
5
|
-
write: (message: string) => void;
|
|
6
|
-
};
|
|
7
|
-
}
|
|
8
|
-
export default function (opts: CalDavOptionsLogging & {
|
|
9
|
-
label: string;
|
|
10
|
-
}): CalDavLogger;
|
|
11
|
-
export {};
|