import { Row as Row$1 } from "../storage.mjs"; import "../contracts.mjs"; import { RollupEngine } from "./core.mjs"; import { TenantCtx } from "@gscdump/contracts"; import { SearchType } from "gscdump/query"; /** * Aggregate one day's `hourly_pages` partition into the daily `pages` shape * and write it to the daily Discover partition. After this runs for date D, * the daily query path serves D from `pages/.../daily/D` and the `hourly/D` * partition becomes read-only / GC-only. * * `(position - 1)` weighting matches the storage convention encoded by * `toSumPosition`: `sum_position = SUM((position - 1) * impressions)`, so a * downstream `SUM(sum_position) / SUM(impressions) + 1` recovers the mean. * * searchType-scoped: only call with `searchType: 'discover'`. The hourly * partition lives under `hourly_pages` and the output lands under `pages` so * existing dashboard queries (which read `pages`) see the rolled-up day * transparently. */ interface RebuildDailyFromHourlyOptions { engine: RollupEngine & { writeDay: (scope: TenantCtx & { table: TableTypeName; date: string; searchType?: SearchType; }, rows: Row$1[]) => Promise; }; ctx: TenantCtx; /** PT calendar day to roll up. */ date: string; searchType: 'discover'; } type TableTypeName = import('@gscdump/contracts').TableName; declare function rebuildDailyFromHourly(opts: RebuildDailyFromHourlyOptions): Promise<{ rowsWritten: number; }>; export { RebuildDailyFromHourlyOptions, rebuildDailyFromHourly };