import type { SpaceConfig } from '../config/types.js'; import type { CdaAssetRecord, CdaReferenceRecord, CdaSyncPayload } from '../contentful/cda-sync.js'; export interface SyncIndexOptions { preview?: boolean; accessToken: string; apiKeyId?: string; payload: CdaSyncPayload; } export interface SyncIndexResult { dbPath: string; assetCount: number; mediaCount: number; referenceCount: number; syncedAt: string; /** `full` replaced all rows; `incremental` merged updates since last sync. */ syncMode: 'full' | 'incremental'; } export type IndexSyncReason = 'missing' | 'schema' | 'stale' | 'invalidated-full' | 'invalidated-incremental' | 'current'; export type IndexSyncMode = 'full' | 'incremental'; export declare function indexSyncModeForReason(reason: IndexSyncReason): IndexSyncMode | null; export declare function rebuildIndexFromPayload(space: SpaceConfig, options: SyncIndexOptions): SyncIndexResult; /** Merges CDA rows into an existing index (upsert). Used for stale refresh with same schema. */ export declare function mergeIndexFromPayload(space: SpaceConfig, options: SyncIndexOptions): SyncIndexResult; /** Upsert a single asset row after CMA upload (optional dedup freshness). */ export declare function upsertAssetRow(space: SpaceConfig, asset: CdaAssetRecord, preview?: boolean): void; /** Removes a catalog row after a committed delete. */ export declare function deleteReferenceRow(space: SpaceConfig, entryId: string, preview?: boolean): void; /** Removes an asset row after a committed delete. */ export declare function deleteAssetRow(space: SpaceConfig, assetId: string, preview?: boolean): void; /** Upsert a single reference row after taxonomy/template create. */ export declare function upsertReferenceRow(space: SpaceConfig, reference: CdaReferenceRecord, preview?: boolean): void; export declare function getStoredSchemaVersion(space: SpaceConfig, preview?: boolean): number | null; export declare function getIndexSyncReason(space: SpaceConfig, preview?: boolean): IndexSyncReason; /** Resolves sync reason including shared invalidation markers (Redis or file). */ export declare function resolveIndexSyncReason(space: SpaceConfig, preview?: boolean): Promise; /** True when the index must be synced (missing, schema mismatch, or older than 24h). */ export declare function indexNeedsRebuild(space: SpaceConfig, preview?: boolean): boolean; export declare function readIndexStatus(space: SpaceConfig, preview?: boolean): { exists: boolean; dbPath: string; syncedAt: string | null; assetCount: number | null; mediaCount: number | null; referenceCount: number | null; apiKeyId: string | null; stale: boolean; }; export declare const INDEX_STALE_MS: number; export declare function isSyncedAtStale(syncedAt: string, now?: number): boolean; //# sourceMappingURL=sync.d.ts.map