feat(03-02): implement tsdav write wrappers (Task 2 GREEN) + fix vevent.ts TS type

write.ts:
- createCalendarEvent: wraps client.createCalendarObject with ${uid}.ics filename
- updateCalendarEvent: wraps client.updateCalendarObject with etag → If-Match (D-08)
- deleteCalendarEvent: wraps client.deleteCalendarObject with etag → If-Match (D-08)
- null etag passed as '' (safe; no crash, no spurious If-Match header)
- Returns raw Response; status code interpretation deferred to outboxWorker (D-07)
- All 6 write.test.ts assertions GREEN

vevent.ts fix:
- ICAL.Time constructor requires 2 args per TS types; pass ICAL.Timezone.localTimezone
  as zone param for all-day DATE values (isDate:true suppresses TZID regardless)
- tsc --noEmit passes clean
This commit is contained in:
Lucas Berger
2026-06-05 17:48:12 -04:00
parent b23b9597df
commit a1243c1b83
2 changed files with 101 additions and 2 deletions
+4 -2
View File
@@ -80,8 +80,10 @@ export function buildVeventString(params: NewEventParams): { uid: string; icsStr
const [sy, sm, sd] = startStr.split('-').map(Number) as [number, number, number]
const [ey, em, ed] = endStr.split('-').map(Number) as [number, number, number]
const startTime = new ICAL.Time({ year: sy, month: sm, day: sd, isDate: true })
const endTime = new ICAL.Time({ year: ey, month: em, day: ed, isDate: true })
// ICAL.Timezone.localTimezone is passed as the zone arg required by TS types.
// isDate:true suppresses any time/TZID output regardless of zone. (D-13)
const startTime = new ICAL.Time({ year: sy, month: sm, day: sd, isDate: true }, ICAL.Timezone.localTimezone)
const endTime = new ICAL.Time({ year: ey, month: em, day: ed, isDate: true }, ICAL.Timezone.localTimezone)
vevent.addPropertyWithValue('dtstart', startTime)
vevent.addPropertyWithValue('dtend', endTime)
} else {