graphql 1.13.4 → 1.13.5
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 +4 -4
- data/lib/graphql/execution/interpreter/arguments_cache.rb +4 -2
- data/lib/graphql/execution/interpreter/runtime.rb +4 -3
- data/lib/graphql/language/document_from_schema_definition.rb +1 -0
- data/lib/graphql/language/lexer.rb +50 -25
- data/lib/graphql/language/lexer.rl +2 -0
- data/lib/graphql/language/nodes.rb +1 -1
- data/lib/graphql/language/parser.rb +829 -816
- data/lib/graphql/language/parser.y +8 -2
- data/lib/graphql/language/printer.rb +4 -0
- data/lib/graphql/schema/build_from_definition.rb +1 -0
- data/lib/graphql/schema/directive.rb +8 -0
- data/lib/graphql/static_validation/base_visitor.rb +1 -1
- data/lib/graphql/static_validation/rules/arguments_are_defined.rb +1 -1
- data/lib/graphql/static_validation/rules/directives_are_in_valid_locations.rb +1 -1
- data/lib/graphql/static_validation/rules/required_arguments_are_present.rb +1 -1
- data/lib/graphql/static_validation/rules/unique_directives_per_location.rb +1 -1
- data/lib/graphql/static_validation/validation_context.rb +4 -0
- data/lib/graphql/tracing/active_support_notifications_tracing.rb +1 -1
- data/lib/graphql/tracing/data_dog_tracing.rb +6 -1
- data/lib/graphql/tracing/platform_tracing.rb +11 -6
- data/lib/graphql/types/relay/node_field.rb +0 -12
- data/lib/graphql/types/relay/nodes_field.rb +6 -0
- data/lib/graphql/version.rb +1 -1
- metadata +3 -3
@@ -147,6 +147,7 @@ rule
|
|
147
147
|
name_without_on:
|
148
148
|
IDENTIFIER
|
149
149
|
| FRAGMENT
|
150
|
+
| REPEATABLE
|
150
151
|
| TRUE
|
151
152
|
| FALSE
|
152
153
|
| operation_type
|
@@ -155,6 +156,7 @@ rule
|
|
155
156
|
enum_name: /* any identifier, but not "true", "false" or "null" */
|
156
157
|
IDENTIFIER
|
157
158
|
| FRAGMENT
|
159
|
+
| REPEATABLE
|
158
160
|
| ON
|
159
161
|
| operation_type
|
160
162
|
| schema_keyword
|
@@ -422,10 +424,14 @@ rule
|
|
422
424
|
}
|
423
425
|
|
424
426
|
directive_definition:
|
425
|
-
description_opt DIRECTIVE DIR_SIGN name arguments_definitions_opt ON directive_locations {
|
426
|
-
result = make_node(:DirectiveDefinition, name: val[3], arguments: val[4], locations: val[
|
427
|
+
description_opt DIRECTIVE DIR_SIGN name arguments_definitions_opt directive_repeatable_opt ON directive_locations {
|
428
|
+
result = make_node(:DirectiveDefinition, name: val[3], arguments: val[4], locations: val[7], repeatable: !!val[5], description: val[0] || get_description(val[1]), definition_line: val[1].line, position_source: val[0] || val[1])
|
427
429
|
}
|
428
430
|
|
431
|
+
directive_repeatable_opt:
|
432
|
+
/* nothing */
|
433
|
+
| REPEATABLE
|
434
|
+
|
429
435
|
directive_locations:
|
430
436
|
name { result = [make_node(:DirectiveLocation, name: val[0].to_s, position_source: val[0])] }
|
431
437
|
| directive_locations PIPE name { val[0] << make_node(:DirectiveLocation, name: val[2].to_s, position_source: val[2]) }
|
@@ -377,6 +377,7 @@ module GraphQL
|
|
377
377
|
Class.new(GraphQL::Schema::Directive) do
|
378
378
|
graphql_name(directive_definition.name)
|
379
379
|
description(directive_definition.description)
|
380
|
+
repeatable(directive_definition.repeatable)
|
380
381
|
locations(*directive_definition.locations.map { |location| location.name.to_sym })
|
381
382
|
ast_node(directive_definition)
|
382
383
|
builder.build_arguments(self, directive_definition.arguments, type_resolver)
|
@@ -101,6 +101,14 @@ module GraphQL
|
|
101
101
|
def on_operation?
|
102
102
|
locations.include?(QUERY) && locations.include?(MUTATION) && locations.include?(SUBSCRIPTION)
|
103
103
|
end
|
104
|
+
|
105
|
+
def repeatable?
|
106
|
+
!!@repeatable
|
107
|
+
end
|
108
|
+
|
109
|
+
def repeatable(new_value)
|
110
|
+
@repeatable = new_value
|
111
|
+
end
|
104
112
|
end
|
105
113
|
|
106
114
|
# @return [GraphQL::Schema::Field, GraphQL::Schema::Argument, Class, Module]
|
@@ -110,7 +110,7 @@ module GraphQL
|
|
110
110
|
end
|
111
111
|
|
112
112
|
def on_directive(node, parent)
|
113
|
-
directive_defn = @
|
113
|
+
directive_defn = @context.schema_directives[node.name]
|
114
114
|
@directive_definitions.push(directive_defn)
|
115
115
|
super
|
116
116
|
@directive_definitions.pop
|
@@ -40,7 +40,7 @@ module GraphQL
|
|
40
40
|
nodes: [used_directives[directive_name], ast_directive],
|
41
41
|
directive: directive_name,
|
42
42
|
))
|
43
|
-
|
43
|
+
elsif !((dir_defn = context.schema_directives[directive_name]) && dir_defn.repeatable?)
|
44
44
|
used_directives[directive_name] = ast_directive
|
45
45
|
end
|
46
46
|
end
|
@@ -11,7 +11,7 @@ module GraphQL
|
|
11
11
|
module ActiveSupportNotificationsTracing
|
12
12
|
# A cache of frequently-used keys to avoid needless string allocations
|
13
13
|
KEYS = NotificationsTracing::KEYS
|
14
|
-
NOTIFICATIONS_ENGINE = NotificationsTracing.new(ActiveSupport::Notifications) if defined?(ActiveSupport)
|
14
|
+
NOTIFICATIONS_ENGINE = NotificationsTracing.new(ActiveSupport::Notifications) if defined?(ActiveSupport::Notifications)
|
15
15
|
|
16
16
|
def self.trace(key, metadata, &blk)
|
17
17
|
NOTIFICATIONS_ENGINE.trace(key, metadata, &blk)
|
@@ -20,7 +20,12 @@ module GraphQL
|
|
20
20
|
|
21
21
|
if key == 'execute_multiplex'
|
22
22
|
operations = data[:multiplex].queries.map(&:selected_operation_name).join(', ')
|
23
|
-
span.resource =
|
23
|
+
span.resource = if operations.empty?
|
24
|
+
first_query = data[:multiplex].queries.first
|
25
|
+
fallback_transaction_name(first_query && first_query.context)
|
26
|
+
else
|
27
|
+
operations
|
28
|
+
end
|
24
29
|
|
25
30
|
# For top span of query, set the analytics sample rate tag, if available.
|
26
31
|
if analytics_enabled?
|
@@ -104,17 +104,22 @@ module GraphQL
|
|
104
104
|
|
105
105
|
private
|
106
106
|
|
107
|
-
# Get the transaction name based on the operation type and name
|
107
|
+
# Get the transaction name based on the operation type and name if possible, or fall back to a user provided
|
108
|
+
# one. Useful for anonymous queries.
|
108
109
|
def transaction_name(query)
|
109
110
|
selected_op = query.selected_operation
|
110
|
-
if selected_op
|
111
|
+
txn_name = if selected_op
|
111
112
|
op_type = selected_op.operation_type
|
112
|
-
op_name = selected_op.name || "anonymous"
|
113
|
+
op_name = selected_op.name || fallback_transaction_name(query.context) || "anonymous"
|
114
|
+
"#{op_type}.#{op_name}"
|
113
115
|
else
|
114
|
-
|
115
|
-
op_name = "anonymous"
|
116
|
+
"query.anonymous"
|
116
117
|
end
|
117
|
-
"GraphQL/#{
|
118
|
+
"GraphQL/#{txn_name}"
|
119
|
+
end
|
120
|
+
|
121
|
+
def fallback_transaction_name(context)
|
122
|
+
context[:tracing_fallback_transaction_name]
|
118
123
|
end
|
119
124
|
|
120
125
|
attr_reader :options
|
@@ -18,18 +18,6 @@ module GraphQL
|
|
18
18
|
# context.schema.object_from_id(id, context)
|
19
19
|
# end
|
20
20
|
#
|
21
|
-
def self.const_missing(const_name)
|
22
|
-
if const_name == :NodeField
|
23
|
-
message = "NodeField is deprecated, use `include GraphQL::Types::Relay::HasNodeField` instead."
|
24
|
-
message += "\n(referenced from #{caller(1, 1).first})"
|
25
|
-
GraphQL::Deprecation.warn(message)
|
26
|
-
|
27
|
-
DeprecatedNodeField
|
28
|
-
else
|
29
|
-
super
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
21
|
DeprecatedNodeField = GraphQL::Schema::Field.new(owner: nil, **HasNodeField.field_options, &HasNodeField.field_block)
|
34
22
|
end
|
35
23
|
end
|
@@ -27,6 +27,12 @@ module GraphQL
|
|
27
27
|
GraphQL::Deprecation.warn(message)
|
28
28
|
|
29
29
|
DeprecatedNodesField
|
30
|
+
elsif const_name == :NodeField
|
31
|
+
message = "NodeField is deprecated, use `include GraphQL::Types::Relay::HasNodeField` instead."
|
32
|
+
message += "\n(referenced from #{caller(1, 1).first})"
|
33
|
+
GraphQL::Deprecation.warn(message)
|
34
|
+
|
35
|
+
DeprecatedNodeField
|
30
36
|
else
|
31
37
|
super
|
32
38
|
end
|
data/lib/graphql/version.rb
CHANGED
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.
|
4
|
+
version: 1.13.5
|
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-01-
|
11
|
+
date: 2022-01-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: benchmark-ips
|
@@ -710,7 +710,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
710
710
|
- !ruby/object:Gem::Version
|
711
711
|
version: '0'
|
712
712
|
requirements: []
|
713
|
-
rubygems_version: 3.
|
713
|
+
rubygems_version: 3.3.3
|
714
714
|
signing_key:
|
715
715
|
specification_version: 4
|
716
716
|
summary: A GraphQL language and runtime for Ruby
|