# SPDX-FileCopyrightText: 2020 ash_graphql contributors # # SPDX-License-Identifier: MIT defmodule AshGraphql.DefaultMetadataHandler do @moduledoc """ Default handler for building response metadata. Returns complexity and duration_ms in the response extensions. """ @doc """ Builds metadata from execution info. Used when `response_metadata: true`. ## Info Map - `:complexity` - Query complexity (integer or nil if analysis disabled) - `:duration_ms` - Execution time in milliseconds - `:operation_name` - The GraphQL operation name (or nil) - `:operation_type` - `:query`, `:mutation`, or `:subscription` """ def build_metadata(info) do %{ complexity: info.complexity, duration_ms: info.duration_ms, operation_name: info.operation_name, operation_type: info.operation_type } end end