Skip to content

Migration Guide (v1 to v2)

tsdav v2 replaced the custom v1 DAVProp[] / DAVFilter[] array DSL with xml-js ElementCompact objects and unified WebDAV, CalDAV, and CardDAV request/response shapes:

  1. Props use ElementCompact objects instead of DAVProp[] arrays
// v1
const v1Props = [{ name: 'getetag', namespace: DAVNamespace.DAV }];
// v2
const v2Props = { [`${DAVNamespaceShort.DAV}:getetag`]: {} };
  1. Filters use ElementCompact objects instead of DAVFilter[] arrays
// v1
const v1Filters = [
{
type: 'comp-filter',
attributes: { name: 'VCALENDAR' },
children: [{ type: 'comp-filter', attributes: { name: 'VEVENT' } }],
},
];
// v2
const v2Filters = [
{
'comp-filter': {
_attributes: { name: 'VCALENDAR' },
'comp-filter': { _attributes: { name: 'VEVENT' } },
},
},
];
  1. 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.
    • propStats retains per-property status codes and namespace maps; props merges successful properties.
  2. Native Fetch & Universal Runtime Portability
    • tsdav v2 uses standard globalThis.fetch (Node.js ≥ 18, browsers, Bun, Deno, Cloudflare Workers, Electron) and accepts a per-client or per-call fetch override.
  3. Detailed Sync Helpers (v2.3+)
    • Prefer syncCalendarsDetailed and smartCollectionSyncDetailed over the deprecated detailedResult: true flag for cleaner TypeScript narrowing.

Use the converter below to translate v1 DAVProp[] or DAVFilter[] JSON arrays into v2 ElementCompact objects:

Live Input
Output