/** * Trusted setup bridge from SQLite's physical-sheet registry to the bound * spreadsheet through the Google Sheets API sync provider. * * Runtime data-plane calls can only use a registered route. This helper is the * matching owner-side path: callers pass the route returned by SQLite plus its * declared header schema, and the provider creates or verifies that projection * tab and header row in the bound spreadsheet. */ import type { RegisteredProjection, RegisteredSyncSheet } from "../storage/syncRegistry.js"; /** Exact projection schema that setup must materialize in the bound spreadsheet. */ export interface RegisteredSyncProjectionDefinition { readonly sheet: RegisteredSyncSheet; readonly headers: readonly string[]; /** * §12 columnMap: for an ADOPTED route, the physical tab's real header row * positionally parallel to `headers` (physicalHeaders[i] is the sheet * header at the column carrying headers[i]). Header-row validation uses * these while every downstream consumer keys by the canonical `headers`. * Absent = the physical headers equal `headers` (default). */ readonly physicalHeaders?: readonly string[]; /** Header used to detect duplicate append identities before a remote write. */ readonly identityField?: string; /** Converts a visible business key into the canonical entity identity. */ readonly entityIdForBusinessKey?: (businessKey: string) => string; /** Optional user-editable boolean control fields for a Sync_Conflicts tab. */ readonly checkboxHeaders?: readonly string[]; } /** Serializable route shape accepted by a remote setup/provisioning client. */ export interface SyncSheetsProvisionRoute { readonly sheetName: string; readonly registeredRange: string; readonly projection: RegisteredProjection; readonly schemaVersion: number; readonly headers: readonly string[]; /** * §12 columnMap: adopted-route physical headers, positionally parallel to * `headers` (see RegisteredSyncProjectionDefinition). Header-row validation * uses these; canonical `headers` stay the keying contract. */ readonly physicalHeaders?: readonly string[]; /** Business-key header retained for append identity validation and fallback lookup. */ readonly identityField?: string; readonly checkboxHeaders?: readonly string[]; } /** Minimal provisioning boundary; the runtime remains independent of fetch or Google SDK types. */ export interface SyncSheetsProvisioner { provisionRegistry(registrations: readonly SyncSheetsProvisionRoute[]): Promise<{ readonly registrations: readonly Omit[]; readonly createdSheets: readonly string[]; readonly initializedHeaders: readonly string[]; }>; } /** * Provisions the complete SQLite-declared projection set without asking an * operator to copy tab names, ranges, or schema versions into the spreadsheet. * * The caller should invoke this after successful local registry writes and may * retry a failed remote call: the provider only creates missing tabs and never * overwrites a nonblank, mismatched header row. */ export declare function provisionRegisteredSyncSheets(provider: SyncSheetsProvisioner, definitions: readonly RegisteredSyncProjectionDefinition[]): Promise>>; //# sourceMappingURL=sheetsProvisioning.d.ts.map