/** * Minimal, dependency-free parsing helpers for CalDAV wire formats. * * Two things are parsed here: * 1. WebDAV multistatus XML (the envelope every PROPFIND/REPORT response * comes back in) into a flat list of `{ href, status, props }` records. * 2. The iCalendar (`text/calendar`) payload carried inside a * `calendar-data` prop, into simple VEVENT records. * * No XML library is used. CalDAV servers only ever send a small, predictable * subset of XML (no CDATA sections, no processing instructions inside the * body, no mixed content beyond text + a handful of known child elements), so * a focused regex/state parser over that subset is enough, this mirrors how * the rest of the agent parses constrained wire formats (see * `src/agent/email/imap-client.ts`). * * Everything here is defensive: malformed or unexpected input yields empty * results, never a thrown exception. Real servers disagree on namespace * prefixes (`d:`, `D:`, `cal:`, `caldav:`, or none at all), so every lookup * matches on the element's local name and ignores whatever prefix is in * front of it. */ /** One `` entry from a multistatus document, flattened. */ export interface DavMultistatusEntry { readonly href: string; /** The raw `` text of the propstat used for `props` (e.g. "HTTP/1.1 200 OK"). */ readonly status: string; readonly props: Readonly>; } /** * Parses a WebDAV multistatus XML body into one flattened entry per * ``. Each entry carries whichever of `current-user-principal`, * `calendar-home-set`, `displayname`, `resourcetype`, `getetag`, and * `calendar-data` were present, keyed under exactly those names. * * When a response has more than one `` (a mix of successful and * failed property lookups, e.g. a 200 batch plus a 404 batch), only the * `200`-status propstat(s) contribute properties; `status` reflects that * outcome. If none reports 200, every propstat is scanned anyway so a * caller still gets whatever was returned instead of nothing. * * Never throws: malformed input yields an empty array. */ export declare function parseMultistatus(xml: string): DavMultistatusEntry[]; /** True when a parsed `resourcetype` prop value (comma-joined local names) denotes a calendar collection. */ export declare function isCalendarResourceType(resourceTypeValue: string | undefined): boolean; /** One parsed VEVENT. `rrule` is the raw RRULE value, never expanded here. */ export interface CalDavEventRecord { readonly uid: string; readonly summary: string; /** Raw DTSTART value, e.g. "20260101T100000Z" or "20260101" for all-day. */ readonly dtstart: string; /** Raw DTEND value; empty string when the event has no DTEND. */ readonly dtend: string; readonly allDay: boolean; readonly location?: string; /** DTSTART's TZID parameter, when present (not applicable to UTC/all-day values). */ readonly tzid?: string; readonly rrule?: string; } /** * Unfolds RFC 5545 folded lines: a CRLF (or bare LF/CR, servers are not all * strict) followed immediately by a single space or tab is a continuation * marker, not a line break. Removing exactly that newline-plus-one-character * sequence rejoins the folded line; anything after the fold point on the * continuation line is real content and must be preserved untouched. */ export declare function unfoldIcsLines(raw: string): string; /** * Parses every VEVENT block out of a raw iCalendar (`calendar-data`) payload. * Handles line unfolding first, then walks BEGIN:VEVENT/END:VEVENT blocks. * Events without a UID are dropped (UID is the only property this module * treats as mandatory). Never throws: malformed input yields an empty array. */ export declare function parseCalendarDataEvents(calendarData: string): CalDavEventRecord[]; //# sourceMappingURL=caldav-parse.d.ts.map