import type { Metadata, MetadataHeadersRulesV2, MetadataHeadersV1, MetadataHeadersV2 } from "./metadata"; export declare const ASSET_PRESERVATION_CACHE = "assetPreservationCacheV2"; /** The preservation cache should be periodically * written to so that the age / expiration is reset. * Note: Up to 12 hours of jitter added to this value. */ export declare const CACHE_PRESERVATION_WRITE_FREQUENCY = 86400; export declare const CACHE_CONTROL_BROWSER = "public, max-age=0, must-revalidate"; export declare const REDIRECTS_VERSION = 1; export declare const HEADERS_VERSION = 2; export declare const HEADERS_VERSION_V1 = 1; export declare const ANALYTICS_VERSION = 1; export declare function normaliseHeaders(headers: MetadataHeadersV1 | MetadataHeadersV2): MetadataHeadersRulesV2; type FindAssetEntryForPath = (path: string) => Promise; type ServeAsset = (assetEntry: AssetEntry, options?: { preserve: boolean; }) => Promise; type CacheStatus = "hit" | "miss"; type CacheResult = `${A}-${CacheStatus}`; export type HandlerMetrics = { preservationCacheResult?: CacheResult<"checked"> | "not-modified" | "disabled"; earlyHintsResult?: CacheResult<"used" | "notused"> | "disabled"; }; type FullHandlerContext = { request: Request; metadata: Metadata; xServerEnvHeader?: string; xDeploymentIdHeader?: boolean; xWebAnalyticsHeader?: boolean; logError: (err: Error) => void; setMetrics?: (metrics: HandlerMetrics) => void; findAssetEntryForPath: FindAssetEntryForPath; getAssetKey(assetEntry: AssetEntry, content: ContentNegotiation): string; negotiateContent(request: Request, assetEntry: AssetEntry): ContentNegotiation; fetchAsset: (assetKey: string) => Promise; generateNotFoundResponse?: (request: Request, findAssetEntryForPath: FindAssetEntryForPath, serveAsset: ServeAsset) => Promise; attachAdditionalHeaders?: (response: Response, content: ContentNegotiation, assetEntry: AssetEntry, asset: Asset) => void; caches: CacheStorage; waitUntil: (promise: Promise) => void; }; export type HandlerContext = FullHandlerContext | (Omit, "caches" | "waitUntil"> & { caches?: undefined; waitUntil?: undefined; }); export declare function generateHandler({ request, metadata, xServerEnvHeader, xDeploymentIdHeader, xWebAnalyticsHeader, logError, setMetrics, findAssetEntryForPath, getAssetKey, negotiateContent, fetchAsset, generateNotFoundResponse, attachAdditionalHeaders, caches, waitUntil, }: HandlerContext): Promise; export declare function parseQualityWeightedList(list?: string): Record; /** Checks if a response is older than CACHE_PRESERVATION_WRITE_FREQUENCY * and should be written to cache again to reset it's expiration. */ export declare function isPreservationCacheResponseExpiring(response: Response): boolean; export {}; //# sourceMappingURL=handler.d.ts.map