Files
com.gregkilmer.www/services/content/src/sync/index.ts
T
Claude e3b0cf60c5 Phase 6: sync jobs, inquiry and order forms
- Sync scheduler in the content service with a per-job cache (sync_cache),
  sync_runs reporting and Healthchecks pings. Jobs: Archidekt, BoardGameGeek,
  cover art (Open Library, TMDB, AniList), Suwayomi and Kavita reading
  progress, Bambuddy filament and Homebox material stock. A note's own value
  always wins over a synced one.
- PersonalReader: updates only Library notes with a matching anilistId,
  changes to Greg's notes are held for review; Reading series with no note
  show as suggestions on the admin Overview.
- /api/inquiries and /api/orders: Turnstile, rate limits, a saved copy in the
  content service (intake token) plus email over SMTP. Orders are re-checked
  against the live notes: accepted only when the category's ordersOpen is
  true and the line has capacity.
- Admin Inbox for saved submissions. Options' inStock is optional so synced
  stock can fill it. All settings from process.env; .env.example per service.
- Sources could not be reached from the build environment; parsers are tested
  against fixtures labelled as not live.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012aSbo2D1qP8cMFQCykf7kx
2026-10-11 23:50:06 +00:00

28 lines
1.3 KiB
TypeScript

/**
* 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;
}