graphql 2.2.6 → 2.2.8
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/dataloader/request.rb +5 -0
- data/lib/graphql/execution/interpreter/runtime.rb +9 -0
- data/lib/graphql/execution/interpreter.rb +3 -3
- data/lib/graphql/schema/base_64_encoder.rb +3 -5
- data/lib/graphql/schema/unique_within_type.rb +1 -1
- data/lib/graphql/schema.rb +2 -1
- data/lib/graphql/static_validation/literal_validator.rb +1 -2
- data/lib/graphql/static_validation/rules/required_input_object_attributes_are_present.rb +1 -1
- data/lib/graphql/testing/helpers.rb +8 -4
- data/lib/graphql/tracing/sentry_trace.rb +5 -4
- data/lib/graphql/version.rb +1 -1
- data/lib/graphql.rb +3 -2
- metadata +2 -17
- data/lib/graphql/schema/base_64_bp.rb +0 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9a58a3c98ecdee8503c62c2bab39d34c0b91ba0b84401b10e1e5fc80afcf8e81
|
4
|
+
data.tar.gz: 1287f3143845004cde0c7c031ebb6d18ee2370835bca23a6a7c3ed0d6d53c81a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 466e806e15a2084248db753bf2a4b444665dd61750c468f15c182f190bff1f97983a34de2c8715ceb777040c8684563a8048556b28f2e5b6f0b53c817babec6f
|
7
|
+
data.tar.gz: 9fab0b39b1d7d0d44f26116bdb6493f18ff735d7d926256a0529060546512c58c50cefb462496c3bdd69fc298b0a9e57b371c6c314b72543dec39d731ebf6e52
|
@@ -14,6 +14,11 @@ module GraphQL
|
|
14
14
|
def load
|
15
15
|
@source.load(@key)
|
16
16
|
end
|
17
|
+
|
18
|
+
def load_with_deprecation_warning
|
19
|
+
warn("Returning `.request(...)` from GraphQL::Dataloader is deprecated, use `.load(...)` instead. (See usage of #{@source} with #{@key.inspect}).")
|
20
|
+
load
|
21
|
+
end
|
17
22
|
end
|
18
23
|
end
|
19
24
|
end
|
@@ -352,6 +352,15 @@ module GraphQL
|
|
352
352
|
end
|
353
353
|
|
354
354
|
field_result = call_method_on_directives(:resolve, object, directives) do
|
355
|
+
if directives.any?
|
356
|
+
# This might be executed in a different context; reset this info
|
357
|
+
runtime_state = get_current_runtime_state
|
358
|
+
runtime_state.current_field = field_defn
|
359
|
+
runtime_state.current_object = object
|
360
|
+
runtime_state.current_arguments = resolved_arguments
|
361
|
+
runtime_state.current_result_name = result_name
|
362
|
+
runtime_state.current_result = selection_result
|
363
|
+
end
|
355
364
|
# Actually call the field resolver and capture the result
|
356
365
|
app_result = begin
|
357
366
|
@current_trace.execute_field(field: field_defn, ast_node: ast_node, query: query, object: object, arguments: kwarg_arguments) do
|
@@ -111,15 +111,15 @@ module GraphQL
|
|
111
111
|
data_result
|
112
112
|
end
|
113
113
|
else
|
114
|
-
result = {
|
115
|
-
"data" => query.context.namespace(:interpreter_runtime)[:runtime].final_result
|
116
|
-
}
|
114
|
+
result = {}
|
117
115
|
|
118
116
|
if query.context.errors.any?
|
119
117
|
error_result = query.context.errors.map(&:to_h)
|
120
118
|
result["errors"] = error_result
|
121
119
|
end
|
122
120
|
|
121
|
+
result["data"] = query.context.namespace(:interpreter_runtime)[:runtime].final_result
|
122
|
+
|
123
123
|
result
|
124
124
|
end
|
125
125
|
if query.context.namespace?(:__query_result_extensions__)
|
@@ -1,18 +1,16 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'graphql/schema/base_64_bp'
|
4
|
-
|
2
|
+
require "base64"
|
5
3
|
module GraphQL
|
6
4
|
class Schema
|
7
5
|
# @api private
|
8
6
|
module Base64Encoder
|
9
7
|
def self.encode(unencoded_text, nonce: false)
|
10
|
-
|
8
|
+
Base64.urlsafe_encode64(unencoded_text, padding: false)
|
11
9
|
end
|
12
10
|
|
13
11
|
def self.decode(encoded_text, nonce: false)
|
14
12
|
# urlsafe_decode64 is for forward compatibility
|
15
|
-
|
13
|
+
Base64.urlsafe_decode64(encoded_text)
|
16
14
|
rescue ArgumentError
|
17
15
|
raise GraphQL::ExecutionError, "Invalid input: #{encoded_text.inspect}"
|
18
16
|
end
|
data/lib/graphql/schema.rb
CHANGED
@@ -743,6 +743,7 @@ module GraphQL
|
|
743
743
|
|
744
744
|
def error_bubbling(new_error_bubbling = nil)
|
745
745
|
if !new_error_bubbling.nil?
|
746
|
+
warn("error_bubbling(#{new_error_bubbling.inspect}) is deprecated; the default value of `false` will be the only option in GraphQL-Ruby 3.0")
|
746
747
|
@error_bubbling = new_error_bubbling
|
747
748
|
else
|
748
749
|
@error_bubbling.nil? ? find_inherited_value(:error_bubbling) : @error_bubbling
|
@@ -1404,7 +1405,7 @@ module GraphQL
|
|
1404
1405
|
else
|
1405
1406
|
@lazy_methods = GraphQL::Execution::Lazy::LazyMethodMap.new
|
1406
1407
|
@lazy_methods.set(GraphQL::Execution::Lazy, :value)
|
1407
|
-
@lazy_methods.set(GraphQL::Dataloader::Request, :
|
1408
|
+
@lazy_methods.set(GraphQL::Dataloader::Request, :load_with_deprecation_warning)
|
1408
1409
|
end
|
1409
1410
|
end
|
1410
1411
|
@lazy_methods
|
@@ -110,7 +110,7 @@ module GraphQL
|
|
110
110
|
# TODO - would be nice to use these to create an error message so the caller knows
|
111
111
|
# that required fields are missing
|
112
112
|
required_field_names = @warden.arguments(type)
|
113
|
-
.select { |argument| argument.type.kind.non_null? &&
|
113
|
+
.select { |argument| argument.type.kind.non_null? && !argument.default_value? }
|
114
114
|
.map!(&:name)
|
115
115
|
|
116
116
|
present_field_names = ast_node.arguments.map(&:name)
|
@@ -122,7 +122,6 @@ module GraphQL
|
|
122
122
|
arg_type = @warden.get_argument(type, name).type
|
123
123
|
recursively_validate(GraphQL::Language::Nodes::NullValue.new(name: name), arg_type)
|
124
124
|
end
|
125
|
-
|
126
125
|
if type.one_of? && ast_node.arguments.size != 1
|
127
126
|
results << Query::InputValidationResult.from_problem("`#{type.graphql_name}` is a OneOf type, so only one argument may be given (instead of #{ast_node.arguments.size})")
|
128
127
|
end
|
@@ -35,7 +35,7 @@ module GraphQL
|
|
35
35
|
return unless parent_type && parent_type.kind.input_object?
|
36
36
|
|
37
37
|
required_fields = context.warden.arguments(parent_type)
|
38
|
-
.select{|arg| arg.type.kind.non_null?}
|
38
|
+
.select{ |arg| arg.type.kind.non_null? && !arg.default_value? }
|
39
39
|
.map!(&:graphql_name)
|
40
40
|
|
41
41
|
present_fields = ast_node.arguments.map(&:name)
|
@@ -5,10 +5,7 @@ module GraphQL
|
|
5
5
|
# @param schema_class [Class<GraphQL::Schema>]
|
6
6
|
# @return [Module] A helpers module which always uses the given schema
|
7
7
|
def self.for(schema_class)
|
8
|
-
|
9
|
-
include SchemaHelpers
|
10
|
-
@@schema_class_for_helpers = schema_class
|
11
|
-
end
|
8
|
+
SchemaHelpers.for(schema_class)
|
12
9
|
end
|
13
10
|
|
14
11
|
class Error < GraphQL::Error
|
@@ -119,6 +116,13 @@ module GraphQL
|
|
119
116
|
# schema will be added later
|
120
117
|
super(nil, *args, **kwargs, &block)
|
121
118
|
end
|
119
|
+
|
120
|
+
def self.for(schema_class)
|
121
|
+
Module.new do
|
122
|
+
include SchemaHelpers
|
123
|
+
@@schema_class_for_helpers = schema_class
|
124
|
+
end
|
125
|
+
end
|
122
126
|
end
|
123
127
|
end
|
124
128
|
end
|
@@ -16,8 +16,8 @@ module GraphQL
|
|
16
16
|
"execute_query_lazy" => "graphql.execute"
|
17
17
|
}.each do |trace_method, platform_key|
|
18
18
|
module_eval <<-RUBY, __FILE__, __LINE__
|
19
|
-
def #{trace_method}(**data
|
20
|
-
instrument_execution("#{platform_key}", "#{trace_method}", data
|
19
|
+
def #{trace_method}(**data)
|
20
|
+
instrument_execution("#{platform_key}", "#{trace_method}", data) { super }
|
21
21
|
end
|
22
22
|
RUBY
|
23
23
|
end
|
@@ -64,9 +64,10 @@ module GraphQL
|
|
64
64
|
return yield unless Sentry.initialized?
|
65
65
|
|
66
66
|
Sentry.with_child_span(op: platform_key, start_timestamp: Sentry.utc_now.to_f) do |span|
|
67
|
-
result =
|
68
|
-
span
|
67
|
+
result = yield
|
68
|
+
return result unless span
|
69
69
|
|
70
|
+
span.finish
|
70
71
|
if trace_method == "execute_multiplex" && data.key?(:multiplex)
|
71
72
|
operation_names = data[:multiplex].queries.map{|q| operation_name(q) }
|
72
73
|
span.set_description(operation_names.join(", "))
|
data/lib/graphql/version.rb
CHANGED
data/lib/graphql.rb
CHANGED
@@ -42,8 +42,8 @@ This is probably a bug in GraphQL-Ruby, please report this error on GitHub: http
|
|
42
42
|
# Turn a query string or schema definition into an AST
|
43
43
|
# @param graphql_string [String] a GraphQL query string or schema definition
|
44
44
|
# @return [GraphQL::Language::Nodes::Document]
|
45
|
-
def self.parse(graphql_string, trace: GraphQL::Tracing::NullTrace)
|
46
|
-
default_parser.parse(graphql_string, trace: trace)
|
45
|
+
def self.parse(graphql_string, trace: GraphQL::Tracing::NullTrace, filename: nil)
|
46
|
+
default_parser.parse(graphql_string, trace: trace, filename: filename)
|
47
47
|
end
|
48
48
|
|
49
49
|
# Read the contents of `filename` and parse them as GraphQL
|
@@ -60,6 +60,7 @@ This is probably a bug in GraphQL-Ruby, please report this error on GitHub: http
|
|
60
60
|
end
|
61
61
|
|
62
62
|
def self.parse_with_racc(string, filename: nil, trace: GraphQL::Tracing::NullTrace)
|
63
|
+
warn "`GraphQL.parse_with_racc` is deprecated; GraphQL-Ruby no longer uses racc for parsing. Call `GraphQL.parse` or `GraphQL::Language::Parser.parse` instead."
|
63
64
|
GraphQL::Language::Parser.parse(string, filename: filename, trace: trace)
|
64
65
|
end
|
65
66
|
|
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Mosolgo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-02-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: racc
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '1.4'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '1.4'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: benchmark-ips
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -400,7 +386,6 @@ files:
|
|
400
386
|
- lib/graphql/schema/addition.rb
|
401
387
|
- lib/graphql/schema/always_visible.rb
|
402
388
|
- lib/graphql/schema/argument.rb
|
403
|
-
- lib/graphql/schema/base_64_bp.rb
|
404
389
|
- lib/graphql/schema/base_64_encoder.rb
|
405
390
|
- lib/graphql/schema/build_from_definition.rb
|
406
391
|
- lib/graphql/schema/build_from_definition/resolve_map.rb
|
@@ -1,26 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'base64'
|
4
|
-
|
5
|
-
# backport from ruby v2.5 to v2.2 that has no `padding` things
|
6
|
-
# @api private
|
7
|
-
module Base64Bp
|
8
|
-
extend Base64
|
9
|
-
|
10
|
-
module_function
|
11
|
-
|
12
|
-
def urlsafe_encode64(bin, padding:)
|
13
|
-
str = strict_encode64(bin)
|
14
|
-
str.tr!("+/", "-_")
|
15
|
-
str.delete!("=") unless padding
|
16
|
-
str
|
17
|
-
end
|
18
|
-
|
19
|
-
def urlsafe_decode64(str)
|
20
|
-
str = str.tr("-_", "+/")
|
21
|
-
if !str.end_with?("=") && str.length % 4 != 0
|
22
|
-
str = str.ljust((str.length + 3) & ~3, "=")
|
23
|
-
end
|
24
|
-
strict_decode64(str)
|
25
|
-
end
|
26
|
-
end
|