/** * Preflight context types and context assembly for the bulk preflight. * * A preflight is a sheet enumeration call plus one bounded data read of the * target tab and receipt tab; `readPreflightData` keeps that two-call * sequence for callers that already enumerated the tabs (the pacing callers * dispatch each transport request individually). Every untrusted SDK payload * is validated with runtime guards (in `preflightParsing`) and promoted into * the typed context the planner can mutate. */ import type { PreflightReceipt, PreflightContext, PreflightRouteOptions, ParsedSheet, ParsedGridData, ParsedSpreadsheetDocument, PreflightReadShape } from "./preflightTypes.js"; import type { SyncMissingTabOperation } from "../../../../contracts/sheets/errors.js"; import type { GoogleSheetsApiTransport } from "../transport/googleSheetsApiTransport.js"; import { type BandEvidence, type BandRange, type EngineRuntime, type ReadCalibration } from "@hikoutei/ikisaki"; export type { ParsedMergedCell, PreflightReceipt, PreflightRow, PreflightContext, PreflightRouteOptions, ParsedSheet, ParsedGridData, ParsedRowData, ParsedCellNumberFormat, ParsedSpreadsheetDocument, PreflightReadShape, } from "./preflightTypes.js"; /** * Enumerates every tab of the spreadsheet (no ranges, so hidden tabs are * returned). The enumeration supplies the sheetIds the data call's grid * data is keyed by and the receipt tab's presence. */ export declare function enumerateSheetProperties(transport: GoogleSheetsApiTransport, spreadsheetId: string, timeoutMs?: number, /** Receives the RAW transport document before parsing — telemetry measures * the true response size from it (the parsed result loses wire detail). */ onRawResponse?: (raw: unknown) => void, /** Admitted pool identity to bind this call to (absent = no binding). */ credentialIndex?: number): Promise; /** The historical whole-table read shape (every fallback/recovery path). */ export declare const LEGACY_PREFLIGHT_READ_SHAPE: PreflightReadShape; /** * Builds the PLANNED preflight ranges for one or more routes, deduplicating * target tabs and adding the shared receipt tab once. The multi-route call * reads ALL needed tabs, so the enumerations and ranged reads are shared * across the routes of one spreadsheet. * * Phase 1 (unified read engine): every all-row band is planned against the * authoritative row bound (`rowBounds`, the enumerated * `gridProperties.rowCount`) and chunked to the shared per-range cell cap * and per-request byte estimate. A span that fits one chunk collapses to * the byte-identical historical OPEN band (`X2:X1048576`); a tab whose bound * exceeds one chunk expands into sequential bands whose LAST band stays * open so a stale-low bound can never truncate coverage. With no bound for * a title (a transport that never reports `gridProperties`) the historical * single open band is planned unchanged (correct, un-banded). */ export declare function buildPreflightRanges(routes: readonly PreflightRouteOptions[], receiptSheet: ParsedSheet | undefined, shape?: PreflightReadShape, receiptBandStart?: number | undefined, rowBounds?: ReadonlyMap, calibration?: ReadCalibration | undefined, evidence?: BandEvidence): readonly BandRange[]; /** * True when one route's TARGET read is column-scoped (header row + key-column * bands) rather than full-width: only key-column routes can hide non-key row * content from the base read, so this selects where the scoped-mode guards * (format-evidence deferral, contiguity fallback) apply. */ export declare function routeUsesColumnScope(route: PreflightRouteOptions, scoped: boolean): boolean; /** * Builds one preflight context for a single route from an enumerated sheet * list. The data read runs through the engine runtime (paced band requests * on the lane the runtime was built for), so a chunked plan is sequential * but lands as ONE reassembled logical document for the context builders. */ export declare function readPreflightData(engine: EngineRuntime, route: PreflightRouteOptions, sheets: readonly ParsedSheet[], /** Field mask override; defaults to the values-only base mask. The * oversized-verification fallback passes the full-evidence preflight mask * to reproduce the historical whole-table read exactly. */ fields?: string, /** Read shape; defaults to the historical whole-table read. */ shape?: PreflightReadShape): Promise; /** * Executes the planned reads across ALL needed tabs and builds a * PreflightContext for each route (keyed by its sheetName), sharing the * read across the routes of one spreadsheet. `operation` classifies an * invalid provider state (e.g. a missing tab) detected while building a * route context. */ export declare function readPreflightDataForRoutes(engine: EngineRuntime, routes: readonly PreflightRouteOptions[], sheets: readonly ParsedSheet[], operation?: SyncMissingTabOperation, /** Field mask override; defaults to the values-only base mask (see * `readPreflightData`). */ fields?: string, /** Read shape; defaults to the historical whole-table read (see * `readPreflightData`). */ shape?: PreflightReadShape): Promise>; /** Builds one route's preflight context from an already-fetched document. */ export declare function buildRouteContext(dataDocument: ParsedSpreadsheetDocument, sheets: readonly ParsedSheet[], route: PreflightRouteOptions, operation?: SyncMissingTabOperation, shape?: PreflightReadShape, receiptBandStart?: number): PreflightContext; /** * Aggregates the receipt grids of ONE logical receipt read (a full or banded * tail read may span several sequential band requests; each band is one * GridData in request order). * * The aggregate preserves the EXACT contract a single-grid `readReceipts` * parse gives the cursor ladder, so band-splitting can never weaken * dedupe/replay: * - the header is validated fail-closed exactly when the FIRST grid starts * at the header row (a full read validates once, on band one; tail bands * start below the header and never check it); * - a duplicate effectId ANYWHERE across the bands fails closed, exactly * like an in-band duplicate (the append-only tab has no legal duplicate); * - the result carries the ordered merged map plus the aggregate's EXACT * first parsed row (the first nonblank receipt row of the first band that * holds one — the value the cursor sentinel compares against * `bandStartRow`) and last content row across all bands. */ export declare function readReceiptsAggregate(grids: readonly ParsedGridData[]): { readonly receipts: ReadonlyMap; readonly lastRow: number; readonly firstParsedRow: number | undefined; }; /** * Parses and validates the hidden receipt tab grid. * * Accepts a FULL grid (starts at the header row; the header is validated * fail-closed exactly like the historical read) or a TAIL BAND grid (starts * at or after row 2; no header check is possible, and every returned row is * parsed as a receipt). `firstParsedRow` lets the reader verify the band * sentinel (a parsed receipt exactly at the cursor row) before trusting the * band coverage. */ export declare function readReceipts(data: ParsedGridData): { readonly receipts: ReadonlyMap; readonly lastRow: number; readonly firstParsedRow: number | undefined; }; //# sourceMappingURL=preflightContext.d.ts.map