/** * routes/calendar.ts, the daemon actually serving `calendar.events.*` and * `calendar.ics.*`. * * These five methods shipped cataloged with `invokable: false` for one * reason: the connector that could satisfy them lived inside a single product, * so the daemon had nothing to call. A caller who trusted the advertisement * and hit `GET /api/calendar/events` got a 404, and scheduled work, triggers * and channel-driven work could not read or write a calendar at all with no * product process attached. * * The connector is now platform capability (`platform/google`), so this module * is the thin part: it maps the descriptors' declared input and output shapes * onto a narrow service slice and nothing else. It performs no I/O, holds no * credential, and knows nothing about Google, a CalDAV-backed or Microsoft * Graph-backed implementation of `CalendarGatewayService` would serve the same * verbs unchanged. * * Two things are deliberate: * * - **`confirm: true` is enforced here, not only advertised.** `events.create` * and `ics.import` write to a real calendar. The descriptors mark them * `dangerous`/`admin` and require `confirm` in their input schema; this * module refuses without it as well, so the guarantee does not depend on * schema validation being reached by every transport. * - **A failure carries its own fix.** The connector answers with * `{ problem, fix }` rather than an exception, and both survive into the * error a caller sees, because "Google refused the request because the * credential lacks the required permission" plus "re-authorize with the * needed scope" is actionable where a bare 500 is not. */ import type { GatewayMethodCatalog } from '../method-catalog.js'; import type { GatewayMethodHandler } from '../method-catalog-shared.js'; /** One event, in the shape `calendar.events.list` advertises. */ export interface CalendarGatewayEventSummary { readonly id: string; readonly title: string; readonly start: string; readonly end: string; readonly location?: string; readonly description?: string; readonly attendees?: readonly string[]; } /** One event, in the shape `calendar.events.get` advertises. */ export interface CalendarGatewayEventDetail extends CalendarGatewayEventSummary { readonly uid?: string; readonly recurrence?: string; } export interface CalendarGatewayListInput { readonly calendarId?: string | undefined; readonly from?: string | undefined; readonly to?: string | undefined; readonly limit?: number | undefined; } export interface CalendarGatewayCreateInput { readonly title: string; readonly start: string; readonly end: string; readonly description?: string | undefined; readonly location?: string | undefined; readonly attendees?: readonly string[] | undefined; readonly calendarId?: string | undefined; } export interface CalendarGatewayCreated { readonly eventId: string; readonly uid: string; readonly createdAt: string; } export interface CalendarGatewayIcsExport { readonly icsContent: string; readonly eventCount: number; } export interface CalendarGatewayIcsImport { readonly imported: number; readonly eventIds: readonly string[]; readonly errors: readonly string[]; } /** * What a calendar backend must be able to do to serve these verbs. * * Every method reports failure by throwing `GatewayVerbError` with an honest * status, a missing scope is a 403, an unknown event id a 404, an * unconfigured account a 400 naming what to configure. Nothing here returns a * plausible empty result in place of an error. */ export interface CalendarGatewayService { listEvents(input: CalendarGatewayListInput): Promise; getEvent(eventId: string, calendarId?: string | undefined): Promise; createEvent(input: CalendarGatewayCreateInput): Promise; exportIcs(input: CalendarGatewayListInput): Promise; importIcs(icsContent: string, calendarId?: string | undefined): Promise; } export declare function createCalendarEventsListHandler(service: CalendarGatewayService): GatewayMethodHandler; export declare function createCalendarEventsGetHandler(service: CalendarGatewayService): GatewayMethodHandler; export declare function createCalendarEventsCreateHandler(service: CalendarGatewayService): GatewayMethodHandler; export declare function createCalendarIcsExportHandler(service: CalendarGatewayService): GatewayMethodHandler; export declare function createCalendarIcsImportHandler(service: CalendarGatewayService): GatewayMethodHandler; /** Attach the calendar handlers to their registered descriptors (missing = no-op). */ export declare function registerCalendarGatewayMethods(catalog: GatewayMethodCatalog, service: CalendarGatewayService): void; //# sourceMappingURL=calendar.d.ts.map