graphql 2.1.6 → 2.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/graphql/backtrace/trace.rb +12 -15
- data/lib/graphql/execution/interpreter.rb +1 -1
- data/lib/graphql/language/block_string.rb +6 -2
- data/lib/graphql/query/null_context.rb +2 -1
- data/lib/graphql/query.rb +0 -2
- data/lib/graphql/schema/input_object.rb +1 -1
- data/lib/graphql/schema/member/scoped.rb +1 -1
- data/lib/graphql/schema.rb +9 -1
- data/lib/graphql/subscriptions/event.rb +7 -1
- data/lib/graphql/subscriptions.rb +2 -2
- data/lib/graphql/types/relay/connection_behaviors.rb +13 -0
- data/lib/graphql/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f0e3e74b44a52e45b992da7fe79d28ff53ea9871ac621517888f887c1a0bd8fb
|
4
|
+
data.tar.gz: fc0a67822082dfc133b1b7f44135df17a5181de2e8404d4b756c4ac0b69a9761
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 00bcdc566706f6fc323b0872c5c36230e7964a518e37825dc14a49cc274cbcac099ab3dca8a24608fafb598dcdfb5c239abb2be81359fd234dbce6954530c044
|
7
|
+
data.tar.gz: efb58609553a215455f026bd686b01c699ea858a732733554198150c1c6a0b8f4b60b514c3aa0532bdc611267039c413cb82b5a63bff7a2a7f6b948a3c154814
|
@@ -2,6 +2,12 @@
|
|
2
2
|
module GraphQL
|
3
3
|
class Backtrace
|
4
4
|
module Trace
|
5
|
+
def initialize(*args, **kwargs, &block)
|
6
|
+
@__backtrace_contexts = {}
|
7
|
+
@__backtrace_last_context = nil
|
8
|
+
super
|
9
|
+
end
|
10
|
+
|
5
11
|
def validate(query:, validate:)
|
6
12
|
if query.multiplex
|
7
13
|
push_query_backtrace_context(query)
|
@@ -42,36 +48,27 @@ module GraphQL
|
|
42
48
|
rescue StandardError => err
|
43
49
|
# This is an unhandled error from execution,
|
44
50
|
# Re-raise it with a GraphQL trace.
|
45
|
-
|
46
|
-
potential_context = multiplex_context[:last_graphql_backtrace_context]
|
47
|
-
|
51
|
+
potential_context = @__backtrace_last_context
|
48
52
|
if potential_context.is_a?(GraphQL::Query::Context) ||
|
49
53
|
potential_context.is_a?(Backtrace::Frame)
|
50
54
|
raise TracedError.new(err, potential_context)
|
51
55
|
else
|
52
56
|
raise
|
53
57
|
end
|
54
|
-
ensure
|
55
|
-
multiplex_context = multiplex.context
|
56
|
-
multiplex_context.delete(:graphql_backtrace_contexts)
|
57
|
-
multiplex_context.delete(:last_graphql_backtrace_context)
|
58
58
|
end
|
59
59
|
|
60
60
|
private
|
61
61
|
|
62
62
|
def push_query_backtrace_context(query)
|
63
63
|
push_data = query
|
64
|
-
multiplex = query.multiplex
|
65
64
|
push_key = []
|
66
|
-
|
67
|
-
|
68
|
-
multiplex.context[:last_graphql_backtrace_context] = push_data
|
65
|
+
@__backtrace_contexts[push_key] = push_data
|
66
|
+
@__backtrace_last_context = push_data
|
69
67
|
end
|
70
68
|
|
71
69
|
def push_field_backtrace_context(field, query, ast_node, arguments, object)
|
72
|
-
multiplex = query.multiplex
|
73
70
|
push_key = query.context[:current_path]
|
74
|
-
push_storage =
|
71
|
+
push_storage = @__backtrace_contexts
|
75
72
|
parent_frame = push_storage[push_key[0..-2]]
|
76
73
|
|
77
74
|
if parent_frame.is_a?(GraphQL::Query)
|
@@ -87,10 +84,10 @@ module GraphQL
|
|
87
84
|
arguments: arguments,
|
88
85
|
parent_frame: parent_frame,
|
89
86
|
)
|
90
|
-
|
91
87
|
push_storage[push_key] = push_data
|
92
|
-
|
88
|
+
@__backtrace_last_context = push_data
|
93
89
|
end
|
90
|
+
|
94
91
|
end
|
95
92
|
end
|
96
93
|
end
|
@@ -47,10 +47,10 @@ module GraphQL
|
|
47
47
|
end
|
48
48
|
|
49
49
|
# Remove leading & trailing blank lines
|
50
|
-
while lines.size > 0 && lines
|
50
|
+
while lines.size > 0 && contains_only_whitespace?(lines.first)
|
51
51
|
lines.shift
|
52
52
|
end
|
53
|
-
while lines.size > 0 && lines
|
53
|
+
while lines.size > 0 && contains_only_whitespace?(lines.last)
|
54
54
|
lines.pop
|
55
55
|
end
|
56
56
|
|
@@ -106,6 +106,10 @@ module GraphQL
|
|
106
106
|
|
107
107
|
nil
|
108
108
|
end
|
109
|
+
|
110
|
+
def self.contains_only_whitespace?(line)
|
111
|
+
line.match?(/^\s*$/)
|
112
|
+
end
|
109
113
|
end
|
110
114
|
end
|
111
115
|
end
|
data/lib/graphql/query.rb
CHANGED
@@ -115,8 +115,6 @@ module GraphQL
|
|
115
115
|
if schema.trace_class <= GraphQL::Tracing::CallLegacyTracers
|
116
116
|
context_tracers += [GraphQL::Backtrace::Tracer]
|
117
117
|
@tracers << GraphQL::Backtrace::Tracer
|
118
|
-
elsif !(current_trace.class <= GraphQL::Backtrace::Trace)
|
119
|
-
raise "Invariant: `backtrace: true` should have provided a trace class with Backtrace mixed in, but it didnt. (Found: #{current_trace.class.ancestors}). This is a bug in GraphQL-Ruby, please report it on GitHub."
|
120
118
|
end
|
121
119
|
end
|
122
120
|
|
@@ -145,7 +145,7 @@ module GraphQL
|
|
145
145
|
end
|
146
146
|
|
147
147
|
# @api private
|
148
|
-
INVALID_OBJECT_MESSAGE = "Expected %{object} to be a key-value object
|
148
|
+
INVALID_OBJECT_MESSAGE = "Expected %{object} to be a key-value object."
|
149
149
|
|
150
150
|
def validate_non_null_input(input, ctx, max_errors: nil)
|
151
151
|
warden = ctx.warden
|
@@ -21,7 +21,7 @@ module GraphQL
|
|
21
21
|
if @reauthorize_scoped_objects != nil
|
22
22
|
@reauthorize_scoped_objects
|
23
23
|
else
|
24
|
-
find_inherited_value(:reauthorize_scoped_objects,
|
24
|
+
find_inherited_value(:reauthorize_scoped_objects, true)
|
25
25
|
end
|
26
26
|
else
|
27
27
|
@reauthorize_scoped_objects = new_value
|
data/lib/graphql/schema.rb
CHANGED
@@ -680,7 +680,7 @@ module GraphQL
|
|
680
680
|
else
|
681
681
|
string_or_document
|
682
682
|
end
|
683
|
-
query =
|
683
|
+
query = query_class.new(self, document: doc, context: context)
|
684
684
|
validator_opts = { schema: self }
|
685
685
|
rules && (validator_opts[:rules] = rules)
|
686
686
|
validator = GraphQL::StaticValidation::Validator.new(**validator_opts)
|
@@ -688,6 +688,14 @@ module GraphQL
|
|
688
688
|
res[:errors]
|
689
689
|
end
|
690
690
|
|
691
|
+
def query_class(new_query_class = NOT_CONFIGURED)
|
692
|
+
if NOT_CONFIGURED.equal?(new_query_class)
|
693
|
+
@query_class || (superclass.respond_to?(:query_class) ? superclass.query_class : GraphQL::Query)
|
694
|
+
else
|
695
|
+
@query_class = new_query_class
|
696
|
+
end
|
697
|
+
end
|
698
|
+
|
691
699
|
attr_writer :validate_max_errors
|
692
700
|
|
693
701
|
def validate_max_errors(new_validate_max_errors = nil)
|
@@ -126,7 +126,13 @@ module GraphQL
|
|
126
126
|
when GraphQL::Schema::InputObject
|
127
127
|
stringify_args(arg_owner, args.to_h, context)
|
128
128
|
else
|
129
|
-
|
129
|
+
if arg_owner.is_a?(Class) && arg_owner < GraphQL::Schema::Enum
|
130
|
+
# `prepare:` may have made the value something other than
|
131
|
+
# a defined value of this enum -- use _that_ in this case.
|
132
|
+
arg_owner.coerce_isolated_input(args) || args
|
133
|
+
else
|
134
|
+
args
|
135
|
+
end
|
130
136
|
end
|
131
137
|
end
|
132
138
|
|
@@ -62,7 +62,7 @@ module GraphQL
|
|
62
62
|
# @return [void]
|
63
63
|
def trigger(event_name, args, object, scope: nil, context: {})
|
64
64
|
# Make something as context-like as possible, even though there isn't a current query:
|
65
|
-
dummy_query =
|
65
|
+
dummy_query = @schema.query_class.new(@schema, "{ __typename }", validate: false, context: context)
|
66
66
|
context = dummy_query.context
|
67
67
|
event_name = event_name.to_s
|
68
68
|
|
@@ -234,7 +234,7 @@ module GraphQL
|
|
234
234
|
|
235
235
|
# @return [Boolean] if true, then a query like this one would be broadcasted
|
236
236
|
def broadcastable?(query_str, **query_options)
|
237
|
-
query =
|
237
|
+
query = @schema.query_class.new(@schema, query_str, **query_options)
|
238
238
|
if !query.valid?
|
239
239
|
raise "Invalid query: #{query.validation_errors.map(&:to_h).inspect}"
|
240
240
|
end
|
@@ -87,6 +87,19 @@ module GraphQL
|
|
87
87
|
node_type.scope_items(items, context)
|
88
88
|
end
|
89
89
|
|
90
|
+
# The connection will skip auth on its nodes if the node_type is configured for that
|
91
|
+
def reauthorize_scoped_objects(new_value = nil)
|
92
|
+
if new_value.nil?
|
93
|
+
if @reauthorize_scoped_objects != nil
|
94
|
+
@reauthorize_scoped_objects
|
95
|
+
else
|
96
|
+
node_type.reauthorize_scoped_objects
|
97
|
+
end
|
98
|
+
else
|
99
|
+
@reauthorize_scoped_objects = new_value
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
90
103
|
# Add the shortcut `nodes` field to this connection and its subclasses
|
91
104
|
def nodes_field(node_nullable: self.node_nullable, field_options: nil)
|
92
105
|
define_nodes_field(node_nullable, field_options: field_options)
|
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: 2.1.
|
4
|
+
version: 2.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Mosolgo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-12-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: racc
|