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

    Type Alias GraphQLLink

    GraphQLLink: (
        op: GraphQLOperation,
        next: GraphQLLinkNext,
    ) => Promise<GraphQLResponse>

    GraphQL middleware link - similar to Relay-style middleware.

    Links form a chain where each link can:

    • Transform the operation before passing to next
    • Transform the response after next returns
    • Short-circuit and return early without calling next
    • Add headers or modify config

    Type Declaration

    // Custom link that adds a header
    const authLink = (op, next) => {
    op.config.headers = { ...op.config.headers, Authorization: "Bearer token" };
    return next(op);
    };

    // Custom link that logs timing
    const timingLink = async (op, next) => {
    const start = Date.now();
    const res = await next(op);
    console.log(`Query took ${Date.now() - start}ms`);
    return res;
    };

    const client = new GraphQLClient({
    url: "https://api.example.com/graphql",
    links: [authLink, timingLink],
    });