refactor: move source options into source file

Co-authored-by: Ona <no-reply@ona.com>
This commit is contained in:
2026-02-14 15:27:57 +00:00
parent c7a1048320
commit 2cf6536e48
3 changed files with 21 additions and 23 deletions

View File

@@ -4,10 +4,29 @@ import type {
ApiCalendarEvent, ApiCalendarEvent,
CalendarEventData, CalendarEventData,
GoogleCalendarClient, GoogleCalendarClient,
GoogleCalendarSourceOptions, GoogleOAuthProvider,
} from "./types" } from "./types"
import { NextEventKey, type NextEvent } from "./calendar-context" import { NextEventKey, type NextEvent } from "./calendar-context"
interface GoogleCalendarSourceBaseOptions {
calendarIds?: string[]
lookaheadHours?: number
}
interface GoogleCalendarSourceWithProvider extends GoogleCalendarSourceBaseOptions {
oauthProvider: GoogleOAuthProvider
client?: never
}
interface GoogleCalendarSourceWithClient extends GoogleCalendarSourceBaseOptions {
oauthProvider?: never
client: GoogleCalendarClient
}
export type GoogleCalendarSourceOptions =
| GoogleCalendarSourceWithProvider
| GoogleCalendarSourceWithClient
import { CalendarFeedItemType, type CalendarFeedItem } from "./feed-items" import { CalendarFeedItemType, type CalendarFeedItem } from "./feed-items"
import { DefaultGoogleCalendarClient } from "./google-calendar-api" import { DefaultGoogleCalendarClient } from "./google-calendar-api"

View File

@@ -7,7 +7,7 @@ export {
type CalendarFeedItem, type CalendarFeedItem,
} from "./feed-items" } from "./feed-items"
export { DefaultGoogleCalendarClient } from "./google-calendar-api" export { DefaultGoogleCalendarClient } from "./google-calendar-api"
export { GoogleCalendarSource } from "./google-calendar-source" export { GoogleCalendarSource, type GoogleCalendarSourceOptions } from "./google-calendar-source"
export { export {
EventStatus, EventStatus,
type EventStatus as EventStatusType, type EventStatus as EventStatusType,
@@ -15,7 +15,6 @@ export {
type ApiEventDateTime, type ApiEventDateTime,
type CalendarEventData, type CalendarEventData,
type GoogleCalendarClient, type GoogleCalendarClient,
type GoogleCalendarSourceOptions,
type GoogleOAuthProvider, type GoogleOAuthProvider,
type ListEventsOptions, type ListEventsOptions,
} from "./types" } from "./types"

View File

@@ -53,23 +53,3 @@ export interface GoogleCalendarClient {
listCalendarIds(): Promise<string[]> listCalendarIds(): Promise<string[]>
listEvents(options: ListEventsOptions): Promise<ApiCalendarEvent[]> listEvents(options: ListEventsOptions): Promise<ApiCalendarEvent[]>
} }
interface GoogleCalendarSourceBaseOptions {
calendarIds?: string[]
/** Default: 24 */
lookaheadHours?: number
}
interface GoogleCalendarSourceWithProvider extends GoogleCalendarSourceBaseOptions {
oauthProvider: GoogleOAuthProvider
client?: never
}
interface GoogleCalendarSourceWithClient extends GoogleCalendarSourceBaseOptions {
oauthProvider?: never
client: GoogleCalendarClient
}
export type GoogleCalendarSourceOptions =
| GoogleCalendarSourceWithProvider
| GoogleCalendarSourceWithClient