import type { LogContext } from '@rocicorp/logger';
import 'urlpattern-polyfill';
import type { ReadonlyJSONValue } from '../../../shared/src/json.ts';
import { type Type } from '../../../shared/src/valita.ts';
import { type ShardID } from '../types/shards.ts';
/**
 * Compiles and validates a URLPattern from configuration.
 *
 * Patterns must be full URLs (e.g., "https://api.example.com/endpoint").
 * URLPattern automatically sets search and hash to wildcard ('*'),
 * which means query parameters and fragments are ignored during matching.
 *
 * @throws Error if the pattern is an invalid URLPattern
 */
export declare function compileUrlPattern(pattern: string): URLPattern;
export type HeaderOptions = {
    apiKey?: string | undefined;
    customHeaders?: Record<string, string> | undefined;
    allowedClientHeaders?: readonly string[] | undefined;
    token?: string | undefined;
    cookie?: string | undefined;
    origin?: string | undefined;
};
export declare const getBodyPreview: (res: Response, lc: LogContext) => Promise<string | undefined>;
export declare function fetchFromAPIServer<TValidator extends Type>(validator: TValidator, source: 'push' | 'transform', lc: LogContext, url: string, allowedUrlPatterns: URLPattern[], shard: ShardID, headerOptions: HeaderOptions, body: ReadonlyJSONValue): Promise<import("../../../shared/src/valita.ts").Infer<TValidator>>;
/**
 * Returns true if the url matches one of the allowedUrlPatterns.
 *
 * URLPattern automatically ignores query parameters and hash fragments during matching
 * because it sets search and hash to wildcard ('*') by default.
 *
 * Example URLPattern patterns:
 * - "https://api.example.com/endpoint" - Exact match for a specific URL
 * - "https://*.example.com/endpoint" - Matches any single subdomain (e.g., "https://api.example.com/endpoint")
 * - "https://*.*.example.com/endpoint" - Matches two subdomains (e.g., "https://api.v1.example.com/endpoint")
 * - "https://api.example.com/*" - Matches any path under /
 * - "https://api.example.com/:version/endpoint" - Matches with named parameter (e.g., "https://api.example.com/v1/endpoint")
 */
export declare function urlMatch(url: string, allowedUrlPatterns: URLPattern[]): boolean;
//# sourceMappingURL=fetch.d.ts.map