/** * caldav-ics.ts, RFC 5545 (iCalendar) reading for the CalDAV calendar backend. * * Pure: no network, no filesystem, no clock, no secret. It is what the CalDAV * gateway service deserialises REPORT/GET payloads with, and what * `calendar.ics.import` parses an uploaded file with. * * The VEVENT subset covered is the one calendar connectors actually need: * SUMMARY, DTSTART, DTEND, DESCRIPTION, LOCATION, UID, ATTENDEE, ORGANIZER, * STATUS, RRULE, plus all-day (VALUE=DATE) detection. Every other property is * kept verbatim in `raw`, so a parse/serialise round-trip does not quietly drop * what this module does not model. * * Why this exists alongside `ics-parser.ts`: that parser answers "what is on * this calendar" for the merged-calendar model and returns `CalendarEvent`s. * This one is the CalDAV wire codec, it keeps the raw ATTENDEE/ORGANIZER * values a PUT has to re-emit, and the display names a response may show, which * are two different things and must not be confused (see `ICalAttendee`). */ /** One ATTENDEE, split into what may be shown and what must be re-emitted. */ export interface ICalAttendee { /** Display name only (CN parameter, or the local-part of the address). */ readonly displayName: string; /** * The property value exactly as it arrived (e.g. `mailto:a@b.example`). * Re-emitted on a PUT so an import preserves the original addressing; never * surfaced in a gateway response, where display names are all a caller gets. */ readonly rawValue: string; } export interface ParsedICalEvent { readonly uid: string; readonly summary: string; readonly description?: string; readonly location?: string; /** ISO-8601 start. */ readonly start: string; /** ISO-8601 end. */ readonly end: string; readonly allDay: boolean; readonly status?: string; /** Raw RRULE value (e.g. "FREQ=WEEKLY;COUNT=10") when present. */ readonly recurrence?: string; readonly attendees: readonly ICalAttendee[]; /** Organizer display name only (CN or local-part). */ readonly organizer?: string; /** Raw organizer value, for re-emission only. */ readonly organizerRaw?: string; /** Every property not modelled above, keyed by upper-case name. */ readonly raw: Readonly>; } /** * Unfold folded content lines: a line beginning with a space or tab is a * continuation of the previous one, not a line of its own. Blank lines are * dropped, no iCalendar property is expressible as one. */ export declare function unfoldLines(content: string): string[]; export declare function escapeText(value: string): string; export declare function unescapeText(value: string): string; /** * Parse an iCalendar date or date-time value into an ISO-8601 string. * Supports YYYYMMDD (DATE), YYYYMMDDTHHMMSSZ (UTC), and YYYYMMDDTHHMMSS * (floating/local). */ export declare function parseICalDate(value: string): { readonly iso: string; readonly allDay: boolean; }; /** The display name for an ATTENDEE/ORGANIZER value: its CN, or the local-part. */ export declare function attendeeDisplayName(params: Readonly>, value: string): string; /** * Parse a full .ics document and return every VEVENT component in it. Multiple * VEVENTs (a VCALENDAR carrying recurrence overrides, or a whole collection * exported as one file) all come back. * * Throws, rather than dropping the event, on a date value it cannot read or * on a DTSTART/DTEND VALUE-type mismatch: a calendar entry silently landing on * the wrong day is worse than a refusal that names the file. */ export declare function parseICS(content: string): ParsedICalEvent[]; /** The first UID in a raw .ics document, if it has one. */ export declare function extractUid(content: string): string | undefined; //# sourceMappingURL=caldav-ics.d.ts.map