/** Milliseconds in a UTC day. Use for date arithmetic without DST surprises. */ declare const MS_PER_DAY = 86400000; /** Format a Date as YYYY-MM-DD (UTC). */ declare function toIsoDate(d: Date): string; /** Most recent date GSC has fully finalized data for (no further updates). */ declare const GSC_FINALIZED_LAG_DAYS = 3; /** Most recent date GSC will return data for, may still be updating. */ declare const GSC_FRESHEST_LAG_DAYS = 1; /** Approximate historical retention window for Search Analytics. */ declare const GSC_RETENTION_MONTHS = 16; /** Today's date (YYYY-MM-DD) in PST. */ declare function getPstDate(): string; /** YYYY-MM-DD for `now() - n` days, UTC. */ declare function daysAgo(n: number): string; /** Most recent finalized date (3 days ago PST). */ declare function getLatestGscDate(): string; /** Freshest date GSC will return (yesterday PST, may still update). */ declare function getFreshestGscDate(): string; /** * Dates that are still pending (1-3 days ago PST). These need to be re-synced * each day until they finalize. */ declare function getPendingDates(): string[]; /** All dates between two YYYY-MM-DD strings (inclusive, oldest first). */ declare function getDateRange(startDate: string, endDate: string): string[]; /** Default span used when chunking long backfills into batches. */ declare const DAYS_PER_RANGE = 30; /** * Like {@link getDateRange} but skips dates outside GSC's queryable window * (older than retention or newer than the freshest date). */ declare function generateGscDateRange(startDate: string, endDate: string): string[]; /** * Group a sorted list of dates into contiguous runs, splitting on either a * gap or after `daysPerRange` dates accumulate. Useful for bucketing * backfill work into bounded jobs. */ declare function groupIntoRanges(dates: string[], daysPerRange?: number): Array<{ startDate: string; endDate: string; }>; /** Inclusive day count between two YYYY-MM-DD strings. */ declare function countDays(startDate: string, endDate: string): number; /** Oldest date GSC retains (~16 months ago). */ declare function getOldestGscDate(): string; /** Add `n` UTC days to a YYYY-MM-DD string (n may be negative). */ declare function addDays(dateStr: string, n: number): string; declare function getPreviousDate(dateStr: string): string; declare function getNextDate(dateStr: string): string; /** True if `dateStr` falls within GSC's queryable window. */ declare function isValidGscDate(dateStr: string): boolean; interface BackfillProgress { progress: number; daysAvailable: number; daysSynced: number; oldestGscDate: string; isComplete: boolean; } /** * Backfill progress (0-1) given the oldest + newest dates synced. * Returns null when no sync data exists. */ declare function getBackfillProgress(oldestDateSynced: string | null, newestDateSynced: string | null): BackfillProgress | null; export { BackfillProgress, DAYS_PER_RANGE, GSC_FINALIZED_LAG_DAYS, GSC_FRESHEST_LAG_DAYS, GSC_RETENTION_MONTHS, MS_PER_DAY, addDays, countDays, daysAgo, generateGscDateRange, getBackfillProgress, getDateRange, getFreshestGscDate, getLatestGscDate, getNextDate, getOldestGscDate, getPendingDates, getPreviousDate, getPstDate, groupIntoRanges, isValidGscDate, toIsoDate };