AniLink - v3.0.0
    Preparing search index...

    Function extractQueryRootField

    • Extracts the root field of a GraphQL query document, the first field selected inside the document's root selection set, using the same lightweight shape checks the cacheability gate applies (see GRAPHQL_QUERY_PATTERN), not a parser. The transport records the extracted field on the cache entry at write time (see ResponseCache.setIfFresh) so root-field-scoped invalidation (see ResponseCache.deleteRootFieldsForUrl) can attribute the entry to the root field its document selects.

      The extraction is fail-closed (see extractRootField): a document whose root field cannot be attributed, a fragment-spread root, a multi-field root selection, an unlocatable selection, yields undefined and the entry stays unscoped, so scoped invalidations drop it alongside the whole-endpoint sweeps. An aliased root field is attributed to the underlying field name, not the alias.

      Internal transport helper: exported for the transport module, not part of the package's public API.

      Parameters

      • data: string | object | undefined

        The request body carrying the { query, variables } document.

      Returns string | undefined

      The query's root field name, or undefined when the root field cannot be determined.