mirror of
https://github.com/kennethnym/aris.git
synced 2026-03-20 17:11:17 +00:00
feat(core): add sourceId to FeedItem
Each FeedSource implementation now sets sourceId on items it produces, allowing consumers to trace items back to their originating source. Co-authored-by: Ona <no-reply@ona.com>
This commit is contained in:
@@ -113,7 +113,7 @@ export class GoogleCalendarSource implements FeedSource<CalendarFeedItem> {
|
||||
const now = context.time.getTime()
|
||||
const lookaheadMs = this.lookaheadHours * 60 * 60 * 1000
|
||||
|
||||
return events.map((event) => createFeedItem(event, now, lookaheadMs))
|
||||
return events.map((event) => createFeedItem(event, now, lookaheadMs, this.id))
|
||||
}
|
||||
|
||||
private async resolveCalendarIds(): Promise<string[]> {
|
||||
@@ -208,11 +208,13 @@ function createFeedItem(
|
||||
event: CalendarEventData,
|
||||
nowMs: number,
|
||||
lookaheadMs: number,
|
||||
sourceId: string,
|
||||
): CalendarFeedItem {
|
||||
const itemType = event.isAllDay ? CalendarFeedItemType.AllDay : CalendarFeedItemType.Event
|
||||
|
||||
return {
|
||||
id: `calendar-${event.calendarId}-${event.eventId}`,
|
||||
sourceId,
|
||||
type: itemType,
|
||||
timestamp: new Date(nowMs),
|
||||
data: event,
|
||||
|
||||
Reference in New Issue
Block a user