UNPKG

caldav-adapter

Version:

CalDAV server for Node.js and Koa. Modernized and maintained for Forward Email.

32 lines (26 loc) 743 B
const _ = require('lodash'); const xml = require('../../../common/xml'); const { build, multistatus } = require('../../../common/x-build'); const commonTags = require('../../../common/tags'); module.exports = function (options) { const tags = commonTags(options); const exec = async function (ctx) { const { children } = xml.getWithChildren( '/D:propertyupdate/D:set/D:prop', ctx.request.xml ); const actions = _.map(children, async (child) => { return tags.getResponse({ resource: 'calCollectionProppatch', child, ctx }); }); const res = await Promise.all(actions); const ms = multistatus(_.compact(res)); return build(ms); }; return { exec }; };