/** * caldav-gateway-wire.ts, the CalDAV requests the gateway verbs make, and the * one place their failures become honest statuses. * * Transport is `CalDavHttpPort`, the port the hoisted CalDAV client already * defines (`platform/google/caldav-client.ts`), so the same injected adapter, * the fetch-backed one in `platform/google/node.ts`, or a fake, drives both. * Nothing here opens a socket. * * What a caller sees on failure is deliberately thin: `CalDAV server returned * HTTP 401.` and nothing else. The base URL, the account name, the credential * and the raw transport error (`getaddrinfo ENOTFOUND cal.example.com`, which * names the host) all stay inside this module, `calendar.ics.import` returns * per-event error strings straight to the caller, so anything this layer puts * in a message is a string that travels. */ import type { CalDavHttpPort } from '../google/caldav-client.js'; export interface CalDavWireResponse { readonly status: number; readonly headers: Readonly>; readonly body: string; } /** * Format an ISO-8601 instant as a CalDAV UTC stamp (YYYYMMDDTHHMMSSZ) for a * time-range filter. An unparseable value is the caller's mistake and says so. */ export declare function toCalDavStamp(iso: string): string; /** `calendar-query` REPORT body, optionally bounded by a time range. */ export declare function calendarQueryBody(from?: string, to?: string): string; /** * A `calendar-query` REPORT that matches ONE VEVENT by UID, server-side. * * The server does the matching, so a UID lookup costs one resource on the wire * instead of the whole collection, and, more importantly, cannot silently miss * an event that a truncated unfiltered listing would have cut off. */ export declare function calendarQueryByUidBody(uid: string): string; /** PROPFIND body listing the collections under a calendar home. */ export declare function propfindCalendarsBody(): string; /** One authenticated CalDAV request. */ export type CalDavRequest = (url: string, method: string, body?: string, extraHeaders?: Readonly>) => Promise; /** * Bind an HTTP port and a credential into a request function that speaks * CalDAV and reports failure as a `GatewayVerbError`. * * Status mapping, unchanged from the surface this replaces: 401/403 are * `CALENDAR_AUTH_FAILED`, 404 is `CALENDAR_NOT_FOUND`, any other 4xx keeps its * own status under `CALENDAR_REQUEST_FAILED`, and anything else (including a * 5xx from the calendar server) is reported as a 502, the daemon is not the * thing that failed. */ export declare function createCalDavRequest(http: CalDavHttpPort, credential: { readonly username: string; readonly password: string; }): CalDavRequest; /** Case-insensitive header lookup, header casing is the server's choice, not ours. */ export declare function readHeader(headers: Readonly>, name: string): string | undefined; //# sourceMappingURL=caldav-gateway-wire.d.ts.map