@shopify/cli-kit
    Preparing search index...

    Function containsMutation

    • Returns true if the GraphQL document contains a mutation operation that would actually be executed for the given (optional) operation name.

      • When operationName is provided, only the matching operation is checked.
      • When operationName is omitted and the document has a single operation, that operation is checked.
      • When the document has multiple operations and no operation name is given, any mutation in the document is treated as a mutation request (the GraphQL server would reject the ambiguous request anyway).

      Returns false for queries, subscriptions, fragment-only documents, and any input that fails to parse as GraphQL.

      Parameters

      • query: string

        The GraphQL document to inspect.

      • OptionaloperationName: string

        Optional name of the operation to check; when set, only that operation is considered.

      Returns boolean

      True if the relevant operation is a mutation; false otherwise.