Files
HealthLog/src/lib/query-keys/cycle.ts
T
Marc-André Bombeck 35e8f076a2 refactor(openapi,queries): feature-located registries behind thin indexes
The five-thousand-line route registry splits into thirteen domain
modules and the query-key factory into twelve feature files — each
behind an index that preserves exact registration order, proven by a
byte-identical generated contract. The factory lint rule learns the new
home directory.
2026-06-11 00:10:00 +02:00

31 lines
1.5 KiB
TypeScript

/**
* Query keys — cycle tracking: calendar windows, history, profile,
* prefs, insights, day logs, and custom symptoms.
* Part of the centralized factory; aggregated in `./index.ts`.
*/
export const cycleKeys = {
/**
* v1.15.0 — cycle-tracking surfaces. `cycle()` is the root prefix every
* cycle write invalidates through (`cycleDependentKeys` in `./index.ts`).
* The calendar read is keyed by `(from, to)` so paging the month strip
* caches each window independently; the history + profile reads each get
* their own slot. A day-log / period write evicts the whole `["cycle"]`
* prefix so the calendar, the wheel, the predictions panel, and the
* history stats repaint in lockstep.
*/
cycle: () => ["cycle"] as const,
cycleCalendar: (from: string, to: string) =>
["cycle", "calendar", from, to] as const,
cycleHistory: (limit: number) => ["cycle", "history", limit] as const,
cycleProfile: () => ["cycle", "profile"] as const,
/** The UNGATED enable/prefs read (`/api/auth/me/cycle-prefs`) — the settings
* on-ramp reads this so a non-FEMALE account can opt in before the gated
* cycle page is reachable. */
cyclePrefs: () => ["cycle", "prefs"] as const,
cycleInsights: () => ["cycle", "insights"] as const,
cycleDayLog: (date: string) => ["cycle", "day-log", date] as const,
/** The caller's own custom symptoms (decrypted labels) the log-day sheet
* merges into the seeded chip grid. */
cycleCustomSymptoms: () => ["cycle", "custom-symptoms"] as const,
};