/** * The sync jobs this service can run, and which of them are enabled. To add * a source, write a `SyncJob` (see types.ts and docs/content-service.md, * "Sync jobs") and add it here behind the settings it needs. */ import { archidektJob } from "./jobs/archidekt.ts"; import { bggJob } from "./jobs/bgg.ts"; import { coversJob } from "./jobs/covers.ts"; import { homelabJobs } from "./jobs/homelab.ts"; import type { SyncSettings } from "./settings.ts"; import type { SyncJob } from "./types.ts"; export { Scheduler } from "./scheduler.ts"; export { SyncCache } from "./cache.ts"; export { syncSettings, type SyncSettings } from "./settings.ts"; export type { SyncJob, SyncContext, SyncResult, SyncedValues } from "./types.ts"; /** Public sources need nothing but their name in SYNC_JOBS. */ export function enabledJobs(s: SyncSettings): SyncJob[] { const common = (name: string) => ({ everyMinutes: s.minutes[name], healthcheckUrl: s.healthchecks[name] }); const jobs: SyncJob[] = []; if (s.enabled.has("archidekt")) jobs.push(archidektJob(common("archidekt"))); if (s.enabled.has("bgg")) jobs.push(bggJob({ ...common("bgg"), token: s.bggToken })); if (s.enabled.has("covers")) jobs.push(coversJob({ ...common("covers"), tmdbApiKey: s.tmdbApiKey })); if (s.homelab) jobs.push(...homelabJobs(s.homelab, common)); return jobs; }