graphql 1.13.12 → 1.13.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of graphql might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 90fcd1d4c840be80d47ed66bad6c4cdd4c16a4981b249b57e7e126a3ff5d5d6d
4
- data.tar.gz: 6d9f87843cd626dff3a9f46158fce7f1be22c3f1aa4131c8b2390b82f93edb52
3
+ metadata.gz: cc7b2a76a8b1650e6669a7f266ff580a3cb78f214307f26527197944441516c9
4
+ data.tar.gz: 9d12f456ee5699eaccc7956ee942ca8165fcca61437b5f9f841abd70b245c52b
5
5
  SHA512:
6
- metadata.gz: 355972194b55f12d4bc43d610249c94ce6d73c574f12688863b01bf60ad4f2a9ad093ee19c76403f4b84371583ea5c236a3d7cfda72e3564a222dd9f12c1d0ea
7
- data.tar.gz: 5ebd795ac0884a46f413e4ede96165d3b2be2489266c36fbc06d90f0d940e69a2afa86c86417757716dc47ddc9c3bdbbe475c7f1547951c5cbe843a0ed7d45e5
6
+ metadata.gz: 00b5e6d26cdb8f62002e66aef32e8b905091f6fdb9f8066cc4537a4747478764bc919b172dd0085e9ab076c7e796158c24de0d2d2483b22dc494d7b96e4f309c
7
+ data.tar.gz: 1dd5c023bccaa8b9f6de3ca6cf9a7153c937ca74fb47c31fd29da9d5dce9942fd779bdd38d5526ef7f107c5bd91eabdaa2c8b74df75c1b57836f3068a085526e
@@ -16,10 +16,9 @@ module GraphQL
16
16
  class ValidationPipeline
17
17
  attr_reader :max_depth, :max_complexity
18
18
 
19
- def initialize(query:, validate:, parse_error:, operation_name_error:, max_depth:, max_complexity:)
19
+ def initialize(query:, parse_error:, operation_name_error:, max_depth:, max_complexity:)
20
20
  @validation_errors = []
21
21
  @internal_representation = nil
22
- @validate = validate
23
22
  @parse_error = parse_error
24
23
  @operation_name_error = operation_name_error
25
24
  @query = query
@@ -72,7 +71,7 @@ module GraphQL
72
71
  elsif @operation_name_error
73
72
  @validation_errors << @operation_name_error
74
73
  else
75
- validation_result = @schema.static_validator.validate(@query, validate: @validate, timeout: @schema.validate_timeout, max_errors: @schema.validate_max_errors)
74
+ validation_result = @schema.static_validator.validate(@query, validate: @query.validate, timeout: @schema.validate_timeout, max_errors: @schema.validate_max_errors)
76
75
  @validation_errors.concat(validation_result[:errors])
77
76
  @internal_representation = validation_result[:irep]
78
77
 
data/lib/graphql/query.rb CHANGED
@@ -434,7 +434,6 @@ module GraphQL
434
434
 
435
435
  @validation_pipeline = GraphQL::Query::ValidationPipeline.new(
436
436
  query: self,
437
- validate: @validate,
438
437
  parse_error: parse_error,
439
438
  operation_name_error: operation_name_error,
440
439
  max_depth: @max_depth,
@@ -176,6 +176,8 @@ module GraphQL
176
176
 
177
177
  # @return Boolean
178
178
  attr_reader :relay_node_field
179
+ # @return Boolean
180
+ attr_reader :relay_nodes_field
179
181
 
180
182
  # @return [Boolean] Should we warn if this field's name conflicts with a built-in method?
181
183
  def method_conflict_warning?
@@ -17,15 +17,21 @@ module GraphQL
17
17
  def platform_trace(platform_key, key, data)
18
18
  tracer.trace(platform_key, service: service_name) do |span|
19
19
  span.span_type = 'custom'
20
+ if defined?(Datadog::Tracing::Metadata::Ext) # Introduced in ddtrace 1.0
21
+ span.set_tag(Datadog::Tracing::Metadata::Ext::TAG_COMPONENT, 'graphql')
22
+ span.set_tag(Datadog::Tracing::Metadata::Ext::TAG_OPERATION, key)
23
+ end
20
24
 
21
25
  if key == 'execute_multiplex'
22
26
  operations = data[:multiplex].queries.map(&:selected_operation_name).join(', ')
23
- span.resource = if operations.empty?
27
+
28
+ resource = if operations.empty?
24
29
  first_query = data[:multiplex].queries.first
25
30
  fallback_transaction_name(first_query && first_query.context)
26
31
  else
27
32
  operations
28
33
  end
34
+ span.resource = resource if resource
29
35
 
30
36
  # For top span of query, set the analytics sample rate tag, if available.
31
37
  if analytics_enabled?
@@ -39,6 +45,8 @@ module GraphQL
39
45
  span.set_tag(:query_string, data[:query].query_string)
40
46
  end
41
47
 
48
+ prepare_span(key, data, span)
49
+
42
50
  yield
43
51
  end
44
52
  end
@@ -47,8 +55,17 @@ module GraphQL
47
55
  options.fetch(:service, 'ruby-graphql')
48
56
  end
49
57
 
58
+ # Implement this method in a subclass to apply custom tags to datadog spans
59
+ # @param key [String] The event being traced
60
+ # @param data [Hash] The runtime data for this event (@see GraphQL::Tracing for keys for each event)
61
+ # @param span [Datadog::Tracing::SpanOperation] The datadog span for this event
62
+ def prepare_span(key, data, span)
63
+ end
64
+
50
65
  def tracer
51
- options.fetch(:tracer, Datadog.tracer)
66
+ default_tracer = defined?(Datadog::Tracing) ? Datadog::Tracing : Datadog.tracer
67
+
68
+ options.fetch(:tracer, default_tracer)
52
69
  end
53
70
 
54
71
  def analytics_available?
@@ -10,6 +10,10 @@ module GraphQL
10
10
  class PlatformTracing
11
11
  class << self
12
12
  attr_accessor :platform_keys
13
+
14
+ def inherited(child_class)
15
+ child_class.platform_keys = self.platform_keys
16
+ end
13
17
  end
14
18
 
15
19
  def initialize(options = {})
@@ -41,7 +45,7 @@ module GraphQL
41
45
 
42
46
  platform_key = if trace_field
43
47
  context = data.fetch(:query).context
44
- cached_platform_key(context, field) { platform_field_key(data[:owner], field) }
48
+ cached_platform_key(context, field, :field) { platform_field_key(data[:owner], field) }
45
49
  else
46
50
  nil
47
51
  end
@@ -57,14 +61,14 @@ module GraphQL
57
61
  when "authorized", "authorized_lazy"
58
62
  type = data.fetch(:type)
59
63
  context = data.fetch(:context)
60
- platform_key = cached_platform_key(context, type) { platform_authorized_key(type) }
64
+ platform_key = cached_platform_key(context, type, :authorized) { platform_authorized_key(type) }
61
65
  platform_trace(platform_key, key, data) do
62
66
  yield
63
67
  end
64
68
  when "resolve_type", "resolve_type_lazy"
65
69
  type = data.fetch(:type)
66
70
  context = data.fetch(:context)
67
- platform_key = cached_platform_key(context, type) { platform_resolve_type_key(type) }
71
+ platform_key = cached_platform_key(context, type, :resolve_type) { platform_resolve_type_key(type) }
68
72
  platform_trace(platform_key, key, data) do
69
73
  yield
70
74
  end
@@ -135,7 +139,7 @@ module GraphQL
135
139
  # If the key isn't present, the given block is called and the result is cached for `key`.
136
140
  #
137
141
  # @return [String]
138
- def cached_platform_key(ctx, key)
142
+ def cached_platform_key(ctx, key, trace_phase)
139
143
  cache = ctx.namespace(self.class)[:platform_key_cache] ||= {}
140
144
  cache.fetch(key) { cache[key] = yield }
141
145
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module GraphQL
3
- VERSION = "1.13.12"
3
+ VERSION = "1.13.15"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphql
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.13.12
4
+ version: 1.13.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Mosolgo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-04-14 00:00:00.000000000 Z
11
+ date: 2022-06-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: benchmark-ips
@@ -722,7 +722,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
722
722
  - !ruby/object:Gem::Version
723
723
  version: '0'
724
724
  requirements: []
725
- rubygems_version: 3.2.32
725
+ rubygems_version: 3.2.22
726
726
  signing_key:
727
727
  specification_version: 4
728
728
  summary: A GraphQL language and runtime for Ruby