Sha256: af9a3a745b6847009ef554525447b4d379dc3e9a3579715bde2ce31dbccebec5

Contents?: true

Size: 839 Bytes

Versions: 5

Compression:

Stored size: 839 Bytes

Contents

# frozen_string_literal: true

require_relative '../patcher'
require_relative 'gateway/watcher'

if Gem.loaded_specs['graphql'] && Gem.loaded_specs['graphql'].version >= Gem::Version.new('2.0.19')
  require_relative 'appsec_trace'
end

module Datadog
  module AppSec
    module Contrib
      module GraphQL
        # Patcher for AppSec on GraphQL
        module Patcher
          include Datadog::AppSec::Contrib::Patcher

          module_function

          def patched?
            Patcher.instance_variable_get(:@patched)
          end

          def target_version
            Integration.version
          end

          def patch
            Gateway::Watcher.watch
            ::GraphQL::Schema.trace_with(AppSecTrace)
            Patcher.instance_variable_set(:@patched, true)
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
datadog-2.7.0 lib/datadog/appsec/contrib/graphql/patcher.rb
datadog-2.6.0 lib/datadog/appsec/contrib/graphql/patcher.rb
datadog-2.5.0 lib/datadog/appsec/contrib/graphql/patcher.rb
datadog-2.4.0 lib/datadog/appsec/contrib/graphql/patcher.rb
datadog-2.3.0 lib/datadog/appsec/contrib/graphql/patcher.rb