graphql 2.6.3 → 2.6.10
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/field_extractor.rb +17 -1
- data/lib/generators/graphql/templates/schema.erb +2 -1
- data/lib/graphql/analysis/query_complexity.rb +2 -2
- data/lib/graphql/dashboard/application_controller.rb +5 -1
- data/lib/graphql/dashboard.rb +3 -0
- data/lib/graphql/dataloader/async_dataloader.rb +333 -68
- data/lib/graphql/dataloader/source.rb +32 -19
- data/lib/graphql/dataloader.rb +52 -36
- data/lib/graphql/execution/field_resolve_step.rb +79 -19
- data/lib/graphql/execution/finalize.rb +7 -8
- data/lib/graphql/execution/interpreter/runtime.rb +1 -8
- data/lib/graphql/execution/interpreter.rb +9 -1
- data/lib/graphql/execution/prepare_object_step.rb +8 -4
- data/lib/graphql/execution/runner.rb +17 -5
- data/lib/graphql/execution/selections_step.rb +10 -6
- data/lib/graphql/execution_error.rb +4 -0
- data/lib/graphql/float_decoding_error.rb +13 -0
- data/lib/graphql/float_encoding_error.rb +28 -0
- data/lib/graphql/language/block_string.rb +6 -11
- data/lib/graphql/language/cache.rb +84 -14
- data/lib/graphql/language/lexer.rb +15 -9
- data/lib/graphql/language/nodes.rb +2 -1
- data/lib/graphql/language.rb +3 -3
- data/lib/graphql/pagination/relation_connection.rb +10 -1
- data/lib/graphql/query/variable_validation_error.rb +16 -1
- data/lib/graphql/query/variables.rb +1 -1
- data/lib/graphql/railtie.rb +2 -1
- data/lib/graphql/schema/build_from_definition.rb +11 -3
- data/lib/graphql/schema/directive.rb +3 -0
- data/lib/graphql/schema/input_object.rb +2 -2
- data/lib/graphql/schema/resolver.rb +1 -1
- data/lib/graphql/schema/wrapper.rb +4 -0
- data/lib/graphql/schema.rb +5 -5
- data/lib/graphql/static_validation/rules/fields_will_merge.rb +66 -29
- data/lib/graphql/subscriptions/serialize.rb +10 -4
- data/lib/graphql/types/float.rb +18 -4
- data/lib/graphql/version.rb +1 -1
- data/lib/graphql.rb +2 -0
- metadata +4 -58
|
@@ -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/types/float.rb
CHANGED
|
@@ -5,12 +5,26 @@ module GraphQL
|
|
|
5
5
|
class Float < GraphQL::Schema::Scalar
|
|
6
6
|
description "Represents signed double-precision fractional values as specified by [IEEE 754](https://en.wikipedia.org/wiki/IEEE_floating_point)."
|
|
7
7
|
|
|
8
|
-
def self.coerce_input(value,
|
|
9
|
-
value.is_a?(Numeric)
|
|
8
|
+
def self.coerce_input(value, ctx)
|
|
9
|
+
return if !value.is_a?(Numeric)
|
|
10
|
+
|
|
11
|
+
value = value.to_f
|
|
12
|
+
if value.finite?
|
|
13
|
+
value
|
|
14
|
+
else
|
|
15
|
+
err = GraphQL::FloatDecodingError.new(value)
|
|
16
|
+
ctx.schema.type_error(err, ctx)
|
|
17
|
+
end
|
|
10
18
|
end
|
|
11
19
|
|
|
12
|
-
def self.coerce_result(value,
|
|
13
|
-
value.to_f
|
|
20
|
+
def self.coerce_result(value, ctx)
|
|
21
|
+
value = value.to_f
|
|
22
|
+
if value.finite?
|
|
23
|
+
value
|
|
24
|
+
else
|
|
25
|
+
err = GraphQL::FloatEncodingError.new(value, context: ctx)
|
|
26
|
+
ctx.schema.type_error(err, ctx)
|
|
27
|
+
end
|
|
14
28
|
end
|
|
15
29
|
|
|
16
30
|
default_scalar true
|
data/lib/graphql/version.rb
CHANGED
data/lib/graphql.rb
CHANGED
|
@@ -93,6 +93,8 @@ This is probably a bug in GraphQL-Ruby, please report this error on GitHub: http
|
|
|
93
93
|
autoload :AnalysisError, "graphql/analysis_error"
|
|
94
94
|
autoload :CoercionError, "graphql/coercion_error"
|
|
95
95
|
autoload :InvalidNameError, "graphql/invalid_name_error"
|
|
96
|
+
autoload :FloatDecodingError, "graphql/float_decoding_error"
|
|
97
|
+
autoload :FloatEncodingError, "graphql/float_encoding_error"
|
|
96
98
|
autoload :IntegerDecodingError, "graphql/integer_decoding_error"
|
|
97
99
|
autoload :IntegerEncodingError, "graphql/integer_encoding_error"
|
|
98
100
|
autoload :StringEncodingError, "graphql/string_encoding_error"
|
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.10
|
|
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-27 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: base64
|
|
@@ -261,34 +261,6 @@ dependencies:
|
|
|
261
261
|
- - ">="
|
|
262
262
|
- !ruby/object:Gem::Version
|
|
263
263
|
version: '0'
|
|
264
|
-
- !ruby/object:Gem::Dependency
|
|
265
|
-
name: jekyll
|
|
266
|
-
requirement: !ruby/object:Gem::Requirement
|
|
267
|
-
requirements:
|
|
268
|
-
- - ">="
|
|
269
|
-
- !ruby/object:Gem::Version
|
|
270
|
-
version: '0'
|
|
271
|
-
type: :development
|
|
272
|
-
prerelease: false
|
|
273
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
274
|
-
requirements:
|
|
275
|
-
- - ">="
|
|
276
|
-
- !ruby/object:Gem::Version
|
|
277
|
-
version: '0'
|
|
278
|
-
- !ruby/object:Gem::Dependency
|
|
279
|
-
name: jekyll-sass-converter
|
|
280
|
-
requirement: !ruby/object:Gem::Requirement
|
|
281
|
-
requirements:
|
|
282
|
-
- - "~>"
|
|
283
|
-
- !ruby/object:Gem::Version
|
|
284
|
-
version: '2.2'
|
|
285
|
-
type: :development
|
|
286
|
-
prerelease: false
|
|
287
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
288
|
-
requirements:
|
|
289
|
-
- - "~>"
|
|
290
|
-
- !ruby/object:Gem::Version
|
|
291
|
-
version: '2.2'
|
|
292
264
|
- !ruby/object:Gem::Dependency
|
|
293
265
|
name: yard
|
|
294
266
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -303,34 +275,6 @@ dependencies:
|
|
|
303
275
|
- - ">="
|
|
304
276
|
- !ruby/object:Gem::Version
|
|
305
277
|
version: '0'
|
|
306
|
-
- !ruby/object:Gem::Dependency
|
|
307
|
-
name: jekyll-algolia
|
|
308
|
-
requirement: !ruby/object:Gem::Requirement
|
|
309
|
-
requirements:
|
|
310
|
-
- - ">="
|
|
311
|
-
- !ruby/object:Gem::Version
|
|
312
|
-
version: '0'
|
|
313
|
-
type: :development
|
|
314
|
-
prerelease: false
|
|
315
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
316
|
-
requirements:
|
|
317
|
-
- - ">="
|
|
318
|
-
- !ruby/object:Gem::Version
|
|
319
|
-
version: '0'
|
|
320
|
-
- !ruby/object:Gem::Dependency
|
|
321
|
-
name: jekyll-redirect-from
|
|
322
|
-
requirement: !ruby/object:Gem::Requirement
|
|
323
|
-
requirements:
|
|
324
|
-
- - ">="
|
|
325
|
-
- !ruby/object:Gem::Version
|
|
326
|
-
version: '0'
|
|
327
|
-
type: :development
|
|
328
|
-
prerelease: false
|
|
329
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
330
|
-
requirements:
|
|
331
|
-
- - ">="
|
|
332
|
-
- !ruby/object:Gem::Version
|
|
333
|
-
version: '0'
|
|
334
278
|
- !ruby/object:Gem::Dependency
|
|
335
279
|
name: m
|
|
336
280
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -516,6 +460,8 @@ files:
|
|
|
516
460
|
- lib/graphql/execution/runner.rb
|
|
517
461
|
- lib/graphql/execution/selections_step.rb
|
|
518
462
|
- lib/graphql/execution_error.rb
|
|
463
|
+
- lib/graphql/float_decoding_error.rb
|
|
464
|
+
- lib/graphql/float_encoding_error.rb
|
|
519
465
|
- lib/graphql/integer_decoding_error.rb
|
|
520
466
|
- lib/graphql/integer_encoding_error.rb
|
|
521
467
|
- lib/graphql/introspection.rb
|