mirror of
https://github.com/kennethnym/aris.git
synced 2026-03-20 17:11:17 +00:00
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:
@@ -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),
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ export {
|
|||||||
AttendeeRole,
|
AttendeeRole,
|
||||||
AttendeeStatus,
|
AttendeeStatus,
|
||||||
CalDavEventStatus,
|
CalDavEventStatus,
|
||||||
|
CalDavFeedItemType,
|
||||||
type CalDavAlarm,
|
type CalDavAlarm,
|
||||||
type CalDavAttendee,
|
type CalDavAttendee,
|
||||||
type CalDavDAVCalendar,
|
type CalDavDAVCalendar,
|
||||||
|
|||||||
@@ -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 --
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user