Migration Guide (v1 to v2)
Key Breaking Changes (1.x → 2.x)
Section titled “Key Breaking Changes (1.x → 2.x)”tsdav v2 replaced the custom v1 DAVProp[] / DAVFilter[] array DSL with xml-js ElementCompact objects and unified WebDAV, CalDAV, and CardDAV request/response shapes:
- Props use
ElementCompactobjects instead ofDAVProp[]arrays
// v1const v1Props = [{ name: 'getetag', namespace: DAVNamespace.DAV }];
// v2const v2Props = { [`${DAVNamespaceShort.DAV}:getetag`]: {} };- Filters use
ElementCompactobjects instead ofDAVFilter[]arrays
// v1const v1Filters = [ { type: 'comp-filter', attributes: { name: 'VCALENDAR' }, children: [{ type: 'comp-filter', attributes: { name: 'VEVENT' } }], },];
// v2const v2Filters = [ { 'comp-filter': { _attributes: { name: 'VCALENDAR' }, 'comp-filter': { _attributes: { name: 'VEVENT' } }, }, },];- Normalized
DAVResponse&propStats- XML property names are normalized to camelCase (for example
current-user-principal→currentUserPrincipal,calendar-data→calendarData), preserving string values without coercing numeric-looking display names or sync tokens. propStatsretains per-property status codes and namespace maps;propsmerges successful properties.
- XML property names are normalized to camelCase (for example
- Native Fetch & Universal Runtime Portability
tsdavv2 uses standardglobalThis.fetch(Node.js ≥ 18, browsers, Bun, Deno, Cloudflare Workers, Electron) and accepts a per-client or per-callfetchoverride.
- Detailed Sync Helpers (v2.3+)
- Prefer
syncCalendarsDetailedandsmartCollectionSyncDetailedover the deprecateddetailedResult: trueflag for cleaner TypeScript narrowing.
- Prefer
Interactive Prop & Filter Migration Tool
Section titled “Interactive Prop & Filter Migration Tool”Use the converter below to translate v1 DAVProp[] or DAVFilter[] JSON arrays into v2 ElementCompact objects:
Live Input
Output