import { GscSearchAnalyticsRequest } from "../contracts.mjs"; import { Result } from "../core/result.mjs"; import { SearchType } from "./constants.mjs"; import { BuilderState, Filter, FilterInput, InternalFilter } from "./types.mjs"; import { QueryError } from "./errors.mjs"; declare function normalizeFilter(input?: FilterInput): Filter | undefined; /** * Errors-as-values core for {@link normalizeBuilderState}: returns an * `invalid-builder-state` `QueryError` when the untrusted partner-API body is * not an object, and an `invalid-filter` `QueryError` when a filter leaf lacks * its string `dimension`/`operator`, instead of throwing. Also coerces * alternative `orderBy` shapes into the canonical `{ column, dir }`. * Receive-edge parse (parse, don't validate), so hosts can map a bad body to a * 4xx and downstream consumers only ever see the canonical shape. */ declare function normalizeBuilderStateResult(state: unknown): Result; declare function normalizeBuilderState(state: unknown): BuilderState; declare function extractDateRange(input?: FilterInput): { startDate?: string; endDate?: string; }; declare function extractMetricFilters(input?: FilterInput): InternalFilter[]; declare function extractSpecialOperatorFilters(input?: FilterInput): InternalFilter[]; /** * Pull `searchType` out of a BuilderState filter. Returns undefined for * missing/invalid shapes — callers treat that as "no scope" (cross-type read). * Validated against the canonical `SearchTypes` set so unknown strings * don't reach the engine. */ declare function extractSearchType(state: BuilderState | undefined | null): SearchType | undefined; /** * Errors-as-values core: turns a `BuilderState` into a GSC API request body or * returns a typed `QueryError` for every modelled bad-query case (missing date * range, out-of-range row limit / start row, hour/dataState mismatch, illegal * aggregationType combination). `resolveToBody` is the throwing wrapper over this * for `.toBody()` and the live-API client paths. */ declare function resolveToBodyResult(state: BuilderState): Result; declare function resolveToBody(state: BuilderState): GscSearchAnalyticsRequest; export { extractDateRange, extractMetricFilters, extractSearchType, extractSpecialOperatorFilters, normalizeBuilderState, normalizeBuilderStateResult, normalizeFilter, resolveToBody, resolveToBodyResult };