mirror of
https://github.com/kennethnym/aris.git
synced 2026-03-20 09:01:19 +00:00
refactor: move source options into source file
Co-authored-by: Ona <no-reply@ona.com>
This commit is contained in:
@@ -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"
|
||||||
|
|
||||||
|
|||||||
@@ -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"
|
||||||
|
|||||||
@@ -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
|
|
||||||
|
|||||||
Reference in New Issue
Block a user