graphql 2.6.7 → 2.6.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.
- checksums.yaml +4 -4
- data/lib/generators/graphql/templates/schema.erb +2 -1
- data/lib/graphql/dashboard/application_controller.rb +5 -1
- data/lib/graphql/dashboard.rb +3 -0
- data/lib/graphql/execution/field_resolve_step.rb +2 -2
- data/lib/graphql/execution/interpreter.rb +6 -0
- data/lib/graphql/execution/runner.rb +1 -2
- data/lib/graphql/language/block_string.rb +6 -11
- data/lib/graphql/language/lexer.rb +5 -2
- data/lib/graphql/language/nodes.rb +2 -1
- data/lib/graphql/language.rb +1 -1
- data/lib/graphql/schema/input_object.rb +2 -2
- data/lib/graphql/subscriptions/serialize.rb +10 -4
- 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: 12ae3a5cc9e399639228a8ccfc1654c7bcaf73a6c81339ad72f7ce90b159eb9d
|
|
4
|
+
data.tar.gz: a998bd1576174777857e365cbe67ffc7b68273bbaa17ad0cd1e609193254417f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2c95b6f2c0aec486d42170e970f59272ece87e9433c5ba8e3fff4838da802993f1de9fcaf3b2c2807fb3365674a7a915265c248470987bf0a9f47d13b90699d1
|
|
7
|
+
data.tar.gz: 03eb4c0fb7cddfd2cebce9a50ce3a9264f6473d4ca037e8a60ddb5d14b3f880a54c6b249958b2b58100dca9ea9b3ad9de04ad25cd333f0d00e620fd724ff7ff6
|
|
@@ -26,7 +26,8 @@ class <%= schema_name %> < GraphQL::Schema
|
|
|
26
26
|
raise(GraphQL::RequiredImplementationMissingError)
|
|
27
27
|
end
|
|
28
28
|
|
|
29
|
-
# Limit the size of incoming queries:
|
|
29
|
+
# Limit the depth and size of incoming queries:
|
|
30
|
+
max_depth(15)
|
|
30
31
|
max_query_string_tokens(5000)
|
|
31
32
|
|
|
32
33
|
# Stop validating when it encounters this many errors:
|
|
@@ -22,7 +22,11 @@ module Graphql
|
|
|
22
22
|
|
|
23
23
|
def schema_class
|
|
24
24
|
@schema_class ||= begin
|
|
25
|
-
|
|
25
|
+
configured_schemas = Array(request.path_parameters[:schema] || request.path_parameters["schema"])
|
|
26
|
+
schema_param = request.query_parameters["schema"]
|
|
27
|
+
schema_param = configured_schemas.find { |schema| schema.to_s == schema_param } if schema_param
|
|
28
|
+
schema_param ||= configured_schemas.first
|
|
29
|
+
|
|
26
30
|
case schema_param
|
|
27
31
|
when Class
|
|
28
32
|
schema_param
|
data/lib/graphql/dashboard.rb
CHANGED
|
@@ -10,6 +10,9 @@ module Graphql
|
|
|
10
10
|
# @example Mounting the Dashboard in your app
|
|
11
11
|
# mount GraphQL::Dashboard, at: "graphql_dashboard", schema: "MySchema"
|
|
12
12
|
#
|
|
13
|
+
# Pass an array to allow selecting from multiple schemas with the `schema` query parameter.
|
|
14
|
+
# mount GraphQL::Dashboard, at: "graphql_dashboard", schema: ["MySchema", "OtherSchema"]
|
|
15
|
+
#
|
|
13
16
|
# @example Authenticating the Dashboard with HTTP Basic Auth
|
|
14
17
|
# # config/initializers/graphql_dashboard.rb
|
|
15
18
|
# GraphQL::Dashboard.middleware.use(Rack::Auth::Basic) do |username, password|
|
|
@@ -130,7 +130,7 @@ module GraphQL
|
|
|
130
130
|
highest_nulled_depth = path.size
|
|
131
131
|
highest_list_depth = nil
|
|
132
132
|
current_field_step = self
|
|
133
|
-
while current_field_step
|
|
133
|
+
while current_field_step && current_field_step.field_definition
|
|
134
134
|
return_type = current_field_step.field_definition.type
|
|
135
135
|
if propagating_null && return_type.non_null?
|
|
136
136
|
highest_nulled_depth = current_field_step.path.size
|
|
@@ -147,7 +147,7 @@ module GraphQL
|
|
|
147
147
|
|
|
148
148
|
if highest_list_depth.nil? || highest_nulled_depth <= highest_list_depth
|
|
149
149
|
kill_field_step = self
|
|
150
|
-
while kill_field_step && highest_nulled_depth <= kill_field_step.path.size
|
|
150
|
+
while kill_field_step && kill_field_step.field_definition && highest_nulled_depth <= kill_field_step.path.size
|
|
151
151
|
kill_field_step.selections_step.killed = true
|
|
152
152
|
kill_field_step = kill_field_step.selections_step.field_resolve_step
|
|
153
153
|
end
|
|
@@ -119,6 +119,12 @@ module GraphQL
|
|
|
119
119
|
end
|
|
120
120
|
|
|
121
121
|
results
|
|
122
|
+
rescue SystemStackError => err
|
|
123
|
+
queries.map do |query|
|
|
124
|
+
schema.query_stack_error(query, err)
|
|
125
|
+
query.result_values ||= { "errors" => query.context.errors.map(&:to_h) }
|
|
126
|
+
query.result
|
|
127
|
+
end
|
|
122
128
|
rescue Exception
|
|
123
129
|
# TODO rescue at a higher level so it will catch errors in analysis, too
|
|
124
130
|
# Assign values here so that the query's `@executed` becomes true
|
|
@@ -5,7 +5,6 @@ module GraphQL
|
|
|
5
5
|
def initialize(multiplex)
|
|
6
6
|
@multiplex = multiplex
|
|
7
7
|
@schema = multiplex.schema
|
|
8
|
-
@steps_queue = []
|
|
9
8
|
@runtime_type_at = {}.compare_by_identity
|
|
10
9
|
@static_type_at = {}.compare_by_identity
|
|
11
10
|
@finalizers = nil
|
|
@@ -53,7 +52,7 @@ module GraphQL
|
|
|
53
52
|
@dataloader.append_job(step)
|
|
54
53
|
end
|
|
55
54
|
|
|
56
|
-
attr_reader :
|
|
55
|
+
attr_reader :schema, :variables, :dataloader, :resolves_lazies, :authorizes, :static_type_at, :runtime_type_at, :finalizers, :input_values
|
|
57
56
|
|
|
58
57
|
# @return [void]
|
|
59
58
|
def add_finalizer(query, result_value, key, finalizer)
|
|
@@ -21,17 +21,12 @@ module GraphQL
|
|
|
21
21
|
next
|
|
22
22
|
end
|
|
23
23
|
line_length = line.size
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
4
|
|
28
|
-
elsif line.match?(/\A[^ ]/)
|
|
29
|
-
0
|
|
30
|
-
else
|
|
31
|
-
line[/\A */].size
|
|
24
|
+
leading = 0
|
|
25
|
+
while leading < line_length && line.getbyte(leading) == 32
|
|
26
|
+
leading += 1
|
|
32
27
|
end
|
|
33
|
-
if
|
|
34
|
-
common_indent =
|
|
28
|
+
if leading < line_length && (common_indent.nil? || leading < common_indent)
|
|
29
|
+
common_indent = leading
|
|
35
30
|
end
|
|
36
31
|
end
|
|
37
32
|
|
|
@@ -41,7 +36,7 @@ module GraphQL
|
|
|
41
36
|
if idx == 0
|
|
42
37
|
next
|
|
43
38
|
else
|
|
44
|
-
line
|
|
39
|
+
line[0, common_indent] = ""
|
|
45
40
|
end
|
|
46
41
|
end
|
|
47
42
|
end
|
|
@@ -175,11 +175,14 @@ module GraphQL
|
|
|
175
175
|
end
|
|
176
176
|
|
|
177
177
|
def line_number
|
|
178
|
-
@scanner.string
|
|
178
|
+
@scanner.string.byteslice(0, @pos).b.count("\n".b) + 1
|
|
179
179
|
end
|
|
180
180
|
|
|
181
181
|
def column_number
|
|
182
|
-
@scanner.string
|
|
182
|
+
line_prefix = @scanner.string.byteslice(0, @pos)
|
|
183
|
+
line_prefix = line_prefix.b unless line_prefix.valid_encoding?
|
|
184
|
+
newline_index = line_prefix.rindex("\n")
|
|
185
|
+
newline_index ? line_prefix.length - newline_index : line_prefix.length + 1
|
|
183
186
|
end
|
|
184
187
|
|
|
185
188
|
def raise_parse_error(message, line = line_number, col = column_number)
|
|
@@ -304,7 +304,8 @@ module GraphQL
|
|
|
304
304
|
children_method_names.map { |m| "#{m}: NO_CHILDREN" } +
|
|
305
305
|
DEFAULT_INITIALIZE_OPTIONS
|
|
306
306
|
|
|
307
|
-
|
|
307
|
+
# Intern descriptions so identical strings across SDL documents share one frozen object.
|
|
308
|
+
assignments = scalar_method_names.map { |m| m == :description ? "@#{m} = #{m} && -#{m}" : "@#{m} = #{m}" } +
|
|
308
309
|
children_method_names.map { |m| "@#{m} = #{m}.freeze" }
|
|
309
310
|
|
|
310
311
|
if name.end_with?("Definition") && name != "FragmentDefinition"
|
data/lib/graphql/language.rb
CHANGED
|
@@ -172,12 +172,12 @@ module GraphQL
|
|
|
172
172
|
types = ctx.types
|
|
173
173
|
|
|
174
174
|
if input.is_a?(Array)
|
|
175
|
-
return GraphQL::Query::InputValidationResult.from_problem(INVALID_OBJECT_MESSAGE % { object: JSON.generate(input
|
|
175
|
+
return GraphQL::Query::InputValidationResult.from_problem(INVALID_OBJECT_MESSAGE % { object: JSON.generate(input) })
|
|
176
176
|
end
|
|
177
177
|
|
|
178
178
|
if !(input.respond_to?(:to_h) || input.respond_to?(:to_unsafe_h))
|
|
179
179
|
# We're not sure it'll act like a hash, so reject it:
|
|
180
|
-
return GraphQL::Query::InputValidationResult.from_problem(INVALID_OBJECT_MESSAGE % { object: JSON.generate(input
|
|
180
|
+
return GraphQL::Query::InputValidationResult.from_problem(INVALID_OBJECT_MESSAGE % { object: JSON.generate(input) })
|
|
181
181
|
end
|
|
182
182
|
|
|
183
183
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
+
require "date"
|
|
2
3
|
require "set"
|
|
3
4
|
module GraphQL
|
|
4
5
|
class Subscriptions
|
|
@@ -10,6 +11,7 @@ module GraphQL
|
|
|
10
11
|
SYMBOL_KEYS_KEY = "__sym_keys__"
|
|
11
12
|
TIMESTAMP_KEY = "__timestamp__"
|
|
12
13
|
TIMESTAMP_FORMAT = "%Y-%m-%d %H:%M:%S.%N%z" # eg '2020-01-01 23:59:59.123456789+05:00'
|
|
14
|
+
TIMESTAMP_CLASS_NAMES = ["Date", "DateTime", "Time"].freeze
|
|
13
15
|
OPEN_STRUCT_KEY = "__ostruct__"
|
|
14
16
|
|
|
15
17
|
module_function
|
|
@@ -24,7 +26,7 @@ module GraphQL
|
|
|
24
26
|
# @param obj [Object] Some subscription-related data to dump
|
|
25
27
|
# @return [String] The stringified object
|
|
26
28
|
def dump(obj)
|
|
27
|
-
JSON.generate(dump_value(obj)
|
|
29
|
+
JSON.generate(dump_value(obj))
|
|
28
30
|
end
|
|
29
31
|
|
|
30
32
|
# This is for turning objects into subscription scopes.
|
|
@@ -72,15 +74,19 @@ module GraphQL
|
|
|
72
74
|
value[SYMBOL_KEY].to_sym
|
|
73
75
|
when TIMESTAMP_KEY
|
|
74
76
|
timestamp_class_name, *timestamp_args = value[TIMESTAMP_KEY]
|
|
75
|
-
timestamp_class =
|
|
76
|
-
|
|
77
|
+
timestamp_class = if TIMESTAMP_CLASS_NAMES.include?(timestamp_class_name)
|
|
78
|
+
Object.const_get(timestamp_class_name, false)
|
|
79
|
+
end
|
|
80
|
+
if defined?(ActiveSupport::TimeWithZone) && timestamp_class_name == ActiveSupport::TimeWithZone.name
|
|
77
81
|
zone_name, timestamp_s = timestamp_args
|
|
78
82
|
zone = ActiveSupport::TimeZone[zone_name]
|
|
79
83
|
raise "Zone #{zone_name} not found, unable to deserialize" unless zone
|
|
80
84
|
zone.strptime(timestamp_s, TIMESTAMP_FORMAT)
|
|
81
|
-
|
|
85
|
+
elsif timestamp_class
|
|
82
86
|
timestamp_s = timestamp_args.first
|
|
83
87
|
timestamp_class.strptime(timestamp_s, TIMESTAMP_FORMAT)
|
|
88
|
+
else
|
|
89
|
+
raise ArgumentError, "Unsupported timestamp class: #{timestamp_class_name.inspect}"
|
|
84
90
|
end
|
|
85
91
|
when OPEN_STRUCT_KEY
|
|
86
92
|
ostruct_values = load_value(value[OPEN_STRUCT_KEY])
|
data/lib/graphql/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: graphql
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.6.
|
|
4
|
+
version: 2.6.8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Robert Mosolgo
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2026-
|
|
10
|
+
date: 2026-08-13 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: base64
|