import type { RequestParameters, ResourceType } from 'maplibre-gl'; export type RequestResourceType = 'metadata' | 'tile'; export type TransformedRequest = { url?: string; headers?: Record; credentials?: RequestCredentials; }; /** * Given a URL, decide how the request for it should actually be made - e.g. attaching an * Authorization header, or opting into cookies via `credentials: 'include'`, for a resource that * needs authorization. Returning undefined leaves the request as-is. * * Mirrors MapLibre's own transformRequest, so one function can drive both: a Resource's own * fetches, and - once its previewer attaches to a map - MapLibre's own tile and style requests. * Synchronous, unlike MapLibre's: it has to run inline as the user pans and zooms, so a token or * other credential it needs should already be in hand by the time it's given to a Resource, * rather than fetched on demand here. * * A transform that attaches credentials should still check the URL - MapLibre calls the same * function for a basemap's own style, glyphs and sprites, which are a different, unrelated origin. */ export type RequestTransform = (url: string, resourceType: RequestResourceType) => TransformedRequest | undefined; export declare function resolveRequest(url: string, resourceType: RequestResourceType, transform?: RequestTransform): { url: string; init?: RequestInit; }; export declare function ourResourceType(maplibreType?: ResourceType): RequestResourceType; export declare function toMapLibreRequest(transformed: TransformedRequest | undefined, url: string): RequestParameters | undefined;