/** * source-sync orchestrator. * * Owns: the `syncIndexedSources` driver loop, `synchronizeIndexedSource` * dispatch table, and the three public query helpers that callers outside this * module need (`loadSourceSyncState`, `getIndexedSourceIds`, * `loadIndexedCatalogEntries`). * * All per-source logic is delegated to the sub-modules under this directory: * state.ts – state I/O, cursor helpers, entry upsert/prune * fetching.ts – SSRF-safe fetch, URL helpers, sitemap/HTML parsing * references.ts – URL→catalog entry construction, package name extractors * reporting.ts – non-indexed source classification * html.ts – generic sitemap and paginated HTML sync drivers * registries/ – one adapter per registry / marketplace */ import type { SourceDefinition } from "../../../types.js"; import { getIndexedSourceIds, loadIndexedCatalogEntries, loadSourceSyncState } from "./state.js"; import type { SourceSyncContext, SourceSyncSourceState } from "./types.js"; /** * Re-exported cursor and state types from the source-sync sub-module tree. * Imported here so external callers can use a single import path. */ export type { SourceSyncCursorState, SourceSyncSourceState, SourceSyncState, } from "./types.js"; /** * Re-exported state helpers from the source-sync sub-module tree. * Imported here so external callers can use a single import path. */ export { loadSourceSyncState, getIndexedSourceIds, loadIndexedCatalogEntries, synchronizeIndexedSource, }; /** * Runs persistent indexed source sync for all enabled high-volume sources. * Reads previous state from disk, advances cursors by up to * `sourceSyncMaxPagesPerRun` pages per source, and writes the updated state, * entries, and report back to disk. */ export declare function syncIndexedSources(projectRoot: string, options?: { maxPagesPerRun?: number; /** Only sync sources whose IDs are in this set. When omitted, all enabled sources are synced. */ sourceIds?: ReadonlySet; }): Promise; declare function synchronizeIndexedSource(source: SourceDefinition, context: SourceSyncContext): Promise; /** Exposes source-sync internals for focused unit testing. */ export declare const sourceSyncInternals: { synchronizeIndexedSource: typeof synchronizeIndexedSource; formatSyncEtaMs: typeof formatSyncEtaMs; estimateRemainingSyncMs: typeof estimateRemainingSyncMs; }; /** * Returns a human-readable remaining-time estimate for the sync progress * line, extrapolated from the average per-source duration observed so far. */ export declare function formatSyncEtaMs(remainingMs: number): string; /** * Linear extrapolation of remaining sync time: assumes the average per-source * duration observed so far continues for the remaining sources (#439). */ export declare function estimateRemainingSyncMs(overallStartMs: number, completedSourceCount: number, totalSourceCount: number): number;