CalDAV adapter
Connect a compatible CalDAV calendar using the interoperability adapter. Initial queries, incremental collection synchronization, and conditional writes form the transport layer for your own reconciliation workflow.
Loading interactive demo…
What you configure
- calendarUrl
- Provide the calendar endpoint without embedded credentials.
- authorization / headers
- Supply runtime authentication and any required customer headers.
- sync token / ETags
- Retain collection cursors and event versions between synchronization cycles.
Essential integration
This assumes the shared Quick start already provides premiumLicense and, for UI views, premiumCalendarOptions. Only the feature-specific setup is shown.
import { PremiumCalendarInteroperability } from '@wts-calendar/core/premium-interoperability';
import type {
CalendarSynchronizationRequest,
CalendarInteropMutation,
} from '@wts-calendar/core/premium-interoperability';
const interoperability = new PremiumCalendarInteroperability({ license: premiumLicense });
// Call after your application obtains an authorized session.
export function connectCalDav(
calendarUrl: string,
getAuthorization: () => string | Promise<string>,
) {
const adapter = interoperability.createCalDavAdapter({
calendarUrl,
authorization: getAuthorization,
timeZone: 'UTC',
});
return {
// Initial sync: omit cursor. For deltas, supply the retained remoteBase snapshot.
preview: (request: CalendarSynchronizationRequest) =>
interoperability.synchronize(adapter, {
...request,
conflictPolicy: 'manual',
push: false,
}),
// Call only after the user resolves conflicts and approves the mutation plan.
commit: (mutations: readonly CalendarInteropMutation[], signal?: AbortSignal) =>
adapter.push(mutations, signal ? { signal } : {}),
};
}
// Example call in your session handler (do not use the WTS key as an OAuth token):
// const connection = connectCalDav('https://dav.example.com/calendars/me/work/', getAuthorization);
// const plan = await connection.preview({
// start: '2026-09-01T00:00:00Z', end: '2026-10-01T00:00:00Z',
// base: lastCommonEvents, local: currentEvents,
// });
// Show plan.reconciliation.conflicts and plan.mutations in your UI.
// After approval, await connection.commit(approvedMutations).
// Pull again and retain the fresh remote IDs/ETags, cursor and common base.Behavior and lifecycle
- Initial reads use calendar-query; incremental reads use sync-collection.
- Embedded calendar data is preferred, with a same-origin retrieval fallback when needed.
Limits and responsibilities
- Browser access depends on the server's CORS and authentication policy; not every deployment allows direct browser connections.
- Provider links must stay on their permitted origin, and response/page ceilings apply.
Premium
Enable this capability
- Optional module
- @wts-calendar/core/premium-interoperability
- Local capability ID
- premium-interoperability · enabled by package-wide Premium
Use the request form to describe your project and deployment origins. Pricing and terms are confirmed privately. A WTS license is separate from provider credentials; do not send passwords or production access tokens.
The live example uses a browser-visible deployment key restricted to this package and approved origins. It does not collect license keys or visitor credentials.