interface ArchiveOptions { limit?: number; signal?: AbortSignal; /** * Earliest capture to list. Inclusive; Wayback-style digits (YYYY through * YYYYMMDDhhmmss) or an ISO 8601 date, and a partial stamp covers the whole * period it names. Providers that can narrow their own query do, the rest * are filtered after the fact, so the window holds across a fan-out. */ from?: string; /** Latest capture to list; the window's other inclusive edge, same formats. */ to?: string; cache?: boolean; ttl?: number; concurrency?: number; batchSize?: number; timeout?: number; retries?: number; apiKey?: string; } interface ArchiveMetadata { [key: string]: unknown; timestamp?: string; status?: number; } interface WaybackMetadata extends ArchiveMetadata { timestamp: string; status: number; provider: string; } interface ArquivoMetadata extends ArchiveMetadata { timestamp: string; status: number; mime?: string; digest?: string; length?: string; provider: "arquivo"; } interface WebarchivMetadata extends ArchiveMetadata { timestamp: string; status?: number; mime?: string; digest?: string; length?: string; provider: "webarchiv"; } interface CommonCrawlMetadata extends ArchiveMetadata { timestamp: string; status: number; digest?: string; mime?: string; length?: string; collection: string; provider: string; } interface PermaccMetadata extends Omit { guid: string; title?: string; status?: string; created_by?: string; } interface ArchiveTodayMetadata extends ArchiveMetadata { hash: string; raw_date?: string; position?: number; } interface MementoMetadata extends ArchiveMetadata { provider: "memento"; archive: string; datetime: string; } interface WebCiteMetadata extends ArchiveMetadata { requestId: string; position?: number; } interface ArchivedPage { url: string; timestamp: string; snapshot: string; _meta: ArchivedPageMetadata; } interface ArchivedPageMetadata { timestamp?: string; status?: number | string; provider?: string; source?: string; [key: string]: unknown; } interface UnsupportedProviderRecord { provider: string; reason: string; } interface ArchiveContentOptions extends ArchiveOptions { timestamp?: string; maxBytes?: number; } interface ArchivedContent { url: string; timestamp: string; snapshot: string; content: string; mime?: string; bytes: number; truncated: boolean; _meta: ArchivedPageMetadata; } interface ArchiveContentResponse { success: boolean; content?: ArchivedContent; error?: string; unsupported?: boolean; unsupportedReason?: string; _meta?: ResponseMetadata; fromCache?: boolean; } /** Rendering applied before two archived bodies are compared. */ type ArchiveDiffFormat = "text" | "raw"; /** Bounds and rendering controls for {@link diffArchivedContent}. */ interface ArchiveDiffOptions { /** Compare visible text by default, or decoded markup/source verbatim. */ format?: ArchiveDiffFormat; /** Unchanged lines kept around each hunk. Defaults to 3. */ context?: number; /** Elapsed time budget for the line diff algorithm. Defaults to 1000 ms. */ timeout?: number; /** Maximum line edit distance considered before aborting. Defaults to 10 000. */ maxEditLength?: number; } /** Capture identity retained beside a derived diff without copying its body. */ interface ArchivedContentSummary { url: string; timestamp: string; snapshot: string; mime?: string; bytes: number; truncated: boolean; provider: string; /** Underlying archive host when the provider is an aggregator such as Memento. */ archive?: string; } /** A bounded line diff between two archived captures that preserves provenance. */ interface ArchivedContentDiff { before: ArchivedContentSummary; after: ArchivedContentSummary; patch: string; additions: number; deletions: number; identical: boolean; /** True when either archived body was truncated before comparison. */ partial: boolean; format: ArchiveDiffFormat; context: number; } interface ResponseMetadata { source: string; provider: string; errorDetails?: unknown; errorName?: string; queryParams?: Record; unsupportedProviders?: UnsupportedProviderRecord[]; [key: string]: unknown; } interface ArchiveResponse { success: boolean; pages: ArchivedPage[]; error?: string; unsupported?: boolean; unsupportedReason?: string; _meta?: ResponseMetadata; fromCache?: boolean; } interface ArchiveProvider { name: string; slug?: string; /** * Initialization options the provider was created with. The aggregator reads * the listing window from them, because a provider without a window-aware * index has no way to apply its own init-level bounds. */ readonly options?: ArchiveOptions; cacheKey?: (options?: ArchiveOptions) => string | undefined; snapshots: (domain: string, options?: ArchiveOptions) => Promise; /** * Read the body of one archived capture. * * Optional: a provider that serves captures only through its own UI has no * such endpoint, and an aggregator reports a missing method the same way it * reports an explicit unsupported response. */ content?: (url: string, options?: ArchiveContentOptions) => Promise; } /** A provider instance or the lazy provider promise accepted by an archive. */ type ProviderReference = ArchiveProvider | Promise; /** * Interface for Archive instances. * Defines the public API that all archive implementations must provide. */ interface ArchiveInterface { readonly options?: ArchiveOptions; snapshots(domain: string, options?: ArchiveOptions): Promise; getPages(domain: string, options?: ArchiveOptions): Promise; content(url: string, options?: ArchiveContentOptions): Promise; getContent(url: string, options?: ArchiveContentOptions): Promise; use(provider: ProviderReference): Promise; useAll(providers: readonly ProviderReference[]): Promise; } export { ArchiveContentOptions, ArchiveContentResponse, ArchiveDiffFormat, ArchiveDiffOptions, ArchiveInterface, ArchiveMetadata, ArchiveOptions, ArchiveProvider, ArchiveResponse, ArchiveTodayMetadata, ArchivedContent, ArchivedContentDiff, ArchivedContentSummary, ArchivedPage, ArchivedPageMetadata, ArquivoMetadata, CommonCrawlMetadata, MementoMetadata, PermaccMetadata, ProviderReference, ResponseMetadata, UnsupportedProviderRecord, WaybackMetadata, WebCiteMetadata, WebarchivMetadata };