(params)
| 10086 | : [...unchanged, ...created, ...updatedWithObjects]; |
| 10087 | }; |
| 10088 | const freeBusyQuery = async (params) => { |
| 10089 | const { url, timeRange, depth, headers, headersToExclude } = params; |
| 10090 | if (timeRange) { |
| 10091 | // validate timeRange |
| 10092 | const ISO_8601 = /^\d{4}(-\d\d(-\d\d(T\d\d:\d\d(:\d\d)?(\.\d+)?(([+-]\d\d:\d\d)|Z)?)?)?)?$/i; |
| 10093 | const ISO_8601_FULL = /^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(\.\d+)?(([+-]\d\d:\d\d)|Z)?$/i; |
| 10094 | if ((!ISO_8601.test(timeRange.start) || !ISO_8601.test(timeRange.end)) && |
| 10095 | (!ISO_8601_FULL.test(timeRange.start) || !ISO_8601_FULL.test(timeRange.end))) { |
| 10096 | throw new Error('invalid timeRange format, not in ISO8601'); |
| 10097 | } |
| 10098 | } |
| 10099 | else { |
| 10100 | throw new Error('timeRange is required'); |
| 10101 | } |
| 10102 | const result = await collectionQuery({ |
| 10103 | url, |
| 10104 | body: { |
| 10105 | 'free-busy-query': cleanupFalsy({ |
| 10106 | _attributes: getDAVAttribute([DAVNamespace.CALDAV]), |
| 10107 | [`${DAVNamespaceShort.CALDAV}:time-range`]: { |
| 10108 | _attributes: { |
| 10109 | start: `${new Date(timeRange.start).toISOString().slice(0, 19).replace(/[-:.]/g, '')}Z`, |
| 10110 | end: `${new Date(timeRange.end).toISOString().slice(0, 19).replace(/[-:.]/g, '')}Z`, |
| 10111 | }, |
| 10112 | }, |
| 10113 | }), |
| 10114 | }, |
| 10115 | defaultNamespace: DAVNamespaceShort.CALDAV, |
| 10116 | depth, |
| 10117 | headers: excludeHeaders(headers, headersToExclude), |
| 10118 | }); |
| 10119 | return result[0]; |
| 10120 | }; |
| 10121 | |
| 10122 | var calendar = /*#__PURE__*/Object.freeze({ |
| 10123 | __proto__: null, |
nothing calls this directly
no test coverage detected