feat(caldav): export CalDavFeedItemType const

Replace hardcoded "caldav-event" string with a
CalDavFeedItemType const object, matching the pattern
used by google-calendar and weatherkit packages.

Co-authored-by: Ona <no-reply@ona.com>
This commit is contained in:
2026-03-01 18:28:05 +00:00
parent 2d7544500d
commit d6a4590b5b
3 changed files with 12 additions and 3 deletions

View File

@@ -4,10 +4,10 @@ import { TimeRelevance, UnknownActionError } from "@aris/core"
import { DAVClient } from "tsdav" import { DAVClient } from "tsdav"
import type { CalDavDAVClient, CalDavEventData, CalDavFeedItem } from "./types.ts" import type { CalDavDAVClient, CalDavEventData, CalDavFeedItem } from "./types.ts"
import { CalDavEventStatus } from "./types.ts"
import { CalDavCalendarKey, type CalendarContext } from "./calendar-context.ts" import { CalDavCalendarKey, type CalendarContext } from "./calendar-context.ts"
import { parseICalEvents } from "./ical-parser.ts" import { parseICalEvents } from "./ical-parser.ts"
import { CalDavEventStatus, CalDavFeedItemType } from "./types.ts"
// -- Source options -- // -- Source options --
@@ -340,7 +340,7 @@ export function computeSignals(
function createFeedItem(event: CalDavEventData, now: Date, timeZone?: string): CalDavFeedItem { function createFeedItem(event: CalDavEventData, now: Date, timeZone?: string): CalDavFeedItem {
return { return {
id: `caldav-event-${event.uid}${event.recurrenceId ? `-${event.recurrenceId}` : ""}`, id: `caldav-event-${event.uid}${event.recurrenceId ? `-${event.recurrenceId}` : ""}`,
type: "caldav-event", type: CalDavFeedItemType.Event,
timestamp: now, timestamp: now,
data: event, data: event,
signals: computeSignals(event, now, timeZone), signals: computeSignals(event, now, timeZone),

View File

@@ -5,6 +5,7 @@ export {
AttendeeRole, AttendeeRole,
AttendeeStatus, AttendeeStatus,
CalDavEventStatus, CalDavEventStatus,
CalDavFeedItemType,
type CalDavAlarm, type CalDavAlarm,
type CalDavAttendee, type CalDavAttendee,
type CalDavDAVCalendar, type CalDavDAVCalendar,

View File

@@ -64,9 +64,17 @@ export interface CalDavEventData extends Record<string, unknown> {
recurrenceId: string | null recurrenceId: string | null
} }
// -- Feed item type --
export const CalDavFeedItemType = {
Event: "caldav-event",
} as const
export type CalDavFeedItemType = (typeof CalDavFeedItemType)[keyof typeof CalDavFeedItemType]
// -- Feed item -- // -- Feed item --
export type CalDavFeedItem = FeedItem<"caldav-event", CalDavEventData> export type CalDavFeedItem = FeedItem<typeof CalDavFeedItemType.Event, CalDavEventData>
// -- DAV client interface -- // -- DAV client interface --