import { DrizzleSchema, TABLE_METADATA, countries, dates, drizzleSchema, hourly_pages, page_queries, pages, queries, search_appearance, search_appearance_page_queries, search_appearance_pages, search_appearance_queries } from "./drizzle-schema.mjs"; import { ColumnDef, ColumnType, Row, TableName, TableSchema, TableSchema as TableSchema$1 } from "@gscdump/contracts"; declare const SCHEMAS: Record; declare function currentSchemaVersion(table: TableName): number; /** * DATE column names for a table. The single schema-derived source every read * path uses to build the legacy-VARCHAR date canonicalization (see * `dateReplaceClause` in `./sql-fragments`), so the engine codec and the CLI * `dump`/`export` commands agree on which columns to cast. */ declare function dateColumnsFor(table: TableName): string[]; declare function allTables(): readonly TableName[]; declare function inferTable(dimensions: readonly string[]): TableName; /** * Natural-key columns for a table: the `sortKey` dimensions that uniquely * identify a metric row (e.g. `['date', 'url']` for `pages`). */ declare function naturalKeyColumns(table: TableName): readonly string[]; /** * Collapse rows that share a natural key (see {@link naturalKeyColumns}) to a * single survivor. * * Correct write and compaction inputs never collide on the natural key — each * (date, dimension) tuple is produced exactly once per slice — so on healthy * data this is a no-op. It exists as a recurrence guard: the 2026-04 monthly * compaction corruption folded a complete month back on top of its own daily * inputs, doubling every row. Absorbing duplicates at every write/compaction * boundary keeps that class of bug from inflating impressions downstream. * * Last occurrence wins. Observed duplicates are byte-identical, so the choice * of survivor is immaterial. */ declare function dedupeByNaturalKey(table: TableName, rows: readonly Row[]): Row[]; declare function dimensionToColumn(dim: string, _table: TableName): string; export { type ColumnDef, type ColumnType, type DrizzleSchema, SCHEMAS, TABLE_METADATA, type TableSchema, allTables, countries, currentSchemaVersion, dateColumnsFor, dates, dedupeByNaturalKey, dimensionToColumn, drizzleSchema, hourly_pages, inferTable, naturalKeyColumns, page_queries, pages, queries, search_appearance, search_appearance_page_queries, search_appearance_pages, search_appearance_queries };