kinetex - v1.0.0-rc.1
    Preparing search index...

    Interface GraphQLClientConfig

    Configuration options for GraphQLClient.

    interface GraphQLClientConfig {
        url: string;
        headers?:
            | Record<string, string>
            | (() => Record<string, string> | Promise<Record<string, string>>);
        fetch?: {
            (input: URL | RequestInfo, init?: RequestInit): Promise<Response>;
            (input: string | URL | Request, init?: RequestInit): Promise<Response>;
        };
        useGETForQueries?: boolean;
        enableAPQ?: boolean;
        timeoutMs?: number;
        retries?: number;
        retryDelayMs?: number;
        links?: GraphQLLink[];
        signal?: AbortSignal;
        onRequest?: (req: GraphQLRequest) => void;
        onResponse?: (res: GraphQLResponse, req: GraphQLRequest) => void;
        onError?: (err: GraphQLClientError, req: GraphQLRequest) => void;
    }
    Index

    Properties

    url: string

    GraphQL endpoint URL

    headers?:
        | Record<string, string>
        | (() => Record<string, string> | Promise<Record<string, string>>)

    Default headers for all requests

    fetch?: {
        (input: URL | RequestInfo, init?: RequestInit): Promise<Response>;
        (input: string | URL | Request, init?: RequestInit): Promise<Response>;
    }

    Fetch implementation

    Type Declaration

      • (input: URL | RequestInfo, init?: RequestInit): Promise<Response>
      • Parameters

        • input: URL | RequestInfo
        • Optionalinit: RequestInit

        Returns Promise<Response>

      • (input: string | URL | Request, init?: RequestInit): Promise<Response>
      • Parameters

        • input: string | URL | Request
        • Optionalinit: RequestInit

        Returns Promise<Response>

    useGETForQueries?: boolean

    Use GET for queries (default: false)

    enableAPQ?: boolean

    Enable Automatic Persisted Queries (APQ).

    APQ improves performance by:

    1. Sending only a SHA-256 hash of the query on first request
    2. Server caches the hash→query mapping
    3. Subsequent requests send only the hash, reducing payload size

    The APQ cache is shared across all GraphQLClient instances (process-wide cache). The cache holds up to 1000 entries with LRU eviction.

    const client = new GraphQLClient({
    url: "https://api.example.com/graphql",
    enableAPQ: true, // Enable APQ
    });
    timeoutMs?: number

    Request timeout in ms (default: 30000)

    retries?: number

    Number of retries on network error (default: 0)

    retryDelayMs?: number

    Retry delay in ms (default: 300)

    links?: GraphQLLink[]

    Middleware/link chain

    signal?: AbortSignal

    AbortSignal

    onRequest?: (req: GraphQLRequest) => void

    Called on every request (for logging, tracing etc.)

    onResponse?: (res: GraphQLResponse, req: GraphQLRequest) => void

    Called on every response

    onError?: (err: GraphQLClientError, req: GraphQLRequest) => void

    Called on error