import { Logger } from '@graphql-hive/logger';
import { CircuitBreakerConfiguration } from './circuit-breaker.cjs';
import { HttpCallConfig } from './http-client.cjs';
type CreateCDNArtifactFetcherArgs = {
    /**
     * The endpoint that should be fetched.
     *
     * It is possible to provide an endpoint list. The first endpoint will be treated as the primary source.
     * The secondary endpoint will be used in case the first endpoint fails to respond.
     *
     * Example:
     *
     * ```
     * [
     *          "https://cdn.graphql-hive.com/artifacts/v1/9fb37bc4-e520-4019-843a-0c8698c25688/supergraph",
     *   "https://cdn-mirror.graphql-hive.com/artifacts/v1/9fb37bc4-e520-4019-843a-0c8698c25688/supergraph"
     * ]
     * ```
     */
    endpoint: string | [string, string];
    /**
     * The access key that is used for authenticating on the endpoints (via the `X-Hive-CDN-Key` header).
     */
    accessKey: string;
    logger?: Logger;
    circuitBreaker?: CircuitBreakerConfiguration;
    /**
     * Custom fetch implementation used for calling the endpoint.
     */
    fetch?: typeof fetch;
    /** Amount of retries per endpoint lookup attempt */
    retry?: HttpCallConfig['retry'];
    /** Timeout per retry for endpoint lookup */
    timeout?: HttpCallConfig['timeout'];
    /**
     * Optional client meta configuration.
     **/
    client?: {
        name: string;
        version: string;
    };
};
type CDNFetchResult = {
    /** Text contents of the artifact */
    contents: string;
    /** SHA-256 Hash */
    hash: string;
    /** Schema Version ID as on Hive Console (optional) */
    schemaVersionId: null | string;
};
export type CDNArtifactFetcher = {
    /** Call the CDN and retrieve the lastest artifact version. */
    fetch(): Promise<CDNFetchResult>;
    /** Dispose the fetcher and cleanup existing timers (e.g. used for circuit breaker) */
    dispose(): void;
};
/**
 * Create a handler for fetching a CDN artifact with built-in cache and circuit breaker.
 * It is intended for polling supergraph, schema sdl or services.
 */
export declare function createCDNArtifactFetcher(args: CreateCDNArtifactFetcherArgs): CDNArtifactFetcher;
export {};
//# sourceMappingURL=cdn-artifact-fetcher.d.ts.map