graphql 2.4.5 → 2.4.6
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/railtie.rb +3 -1
- data/lib/graphql/schema/member/has_arguments.rb +13 -5
- data/lib/graphql/schema/visibility/migration.rb +1 -0
- data/lib/graphql/schema/visibility/profile.rb +6 -0
- data/lib/graphql/schema/warden.rb +14 -1
- data/lib/graphql/schema.rb +3 -1
- data/lib/graphql/version.rb +1 -1
- data/lib/graphql.rb +1 -0
- 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: 5cd45aa292bddd6fff0d06c9b040cf2f87cf81926a4f8c2e53febf3f434b6dac
|
4
|
+
data.tar.gz: 0c736a7432142b948c893a2db5049d97a54660e102ea75c27bd3058680e764f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '07404039c9ca7c2c78867bba53fd3ed60d89ac48564e909e964bb7e7298e86e2406ccd70113a49b26dc6cfd1f48580e141d1bdc015eb2289718c973c2cc6db6c'
|
7
|
+
data.tar.gz: 1826580e9cafcac3dbe46ddf6aeb3451847f390143a68e799633727fa05ad8b4e400b058279887b0ca62fb5b4bc7a4af66ce991a8377f2b3a4ffdda34edbfea6
|
data/lib/graphql/railtie.rb
CHANGED
@@ -10,7 +10,9 @@ module GraphQL
|
|
10
10
|
class Railtie < Rails::Railtie
|
11
11
|
config.graphql = ActiveSupport::OrderedOptions.new
|
12
12
|
config.graphql.parser_cache = false
|
13
|
-
config.
|
13
|
+
config.before_eager_load do
|
14
|
+
GraphQL.eager_load!
|
15
|
+
end
|
14
16
|
|
15
17
|
initializer("graphql.cache") do |app|
|
16
18
|
if config.graphql.parser_cache
|
@@ -359,7 +359,8 @@ module GraphQL
|
|
359
359
|
if application_object.nil?
|
360
360
|
nil
|
361
361
|
else
|
362
|
-
|
362
|
+
arg_loads_type = argument.loads
|
363
|
+
maybe_lazy_resolve_type = context.schema.resolve_type(arg_loads_type, application_object, context)
|
363
364
|
context.query.after_lazy(maybe_lazy_resolve_type) do |resolve_type_result|
|
364
365
|
if resolve_type_result.is_a?(Array) && resolve_type_result.size == 2
|
365
366
|
application_object_type, application_object = resolve_type_result
|
@@ -368,10 +369,17 @@ module GraphQL
|
|
368
369
|
# application_object is already assigned
|
369
370
|
end
|
370
371
|
|
371
|
-
if
|
372
|
-
|
373
|
-
|
374
|
-
|
372
|
+
passes_possible_types_check = if context.types.loadable?(arg_loads_type, context)
|
373
|
+
if arg_loads_type.kind.union?
|
374
|
+
# This union is used in `loads:` but not otherwise visible to this query
|
375
|
+
context.types.loadable_possible_types(arg_loads_type, context).include?(application_object_type)
|
376
|
+
else
|
377
|
+
true
|
378
|
+
end
|
379
|
+
else
|
380
|
+
context.types.possible_types(arg_loads_type).include?(application_object_type)
|
381
|
+
end
|
382
|
+
if !passes_possible_types_check
|
375
383
|
err = GraphQL::LoadApplicationObjectFailedError.new(context: context, argument: argument, id: id, object: application_object)
|
376
384
|
application_object = load_application_object_failed(err)
|
377
385
|
end
|
@@ -84,6 +84,8 @@ module GraphQL
|
|
84
84
|
@cached_arguments = Hash.new do |h, owner|
|
85
85
|
h[owner] = non_duplicate_items(owner.all_argument_definitions, @cached_visible_arguments)
|
86
86
|
end.compare_by_identity
|
87
|
+
|
88
|
+
@loadable_possible_types = Hash.new { |h, union_type| h[union_type] = union_type.possible_types }.compare_by_identity
|
87
89
|
end
|
88
90
|
|
89
91
|
def field_on_visible_interface?(field, owner)
|
@@ -249,6 +251,10 @@ module GraphQL
|
|
249
251
|
!@all_types[t.graphql_name] && @cached_visible[t]
|
250
252
|
end
|
251
253
|
|
254
|
+
def loadable_possible_types(t, _ctx)
|
255
|
+
@loadable_possible_types[t]
|
256
|
+
end
|
257
|
+
|
252
258
|
def loaded_types
|
253
259
|
@all_types.values
|
254
260
|
end
|
@@ -72,6 +72,7 @@ module GraphQL
|
|
72
72
|
def interface_type_memberships(obj_t, ctx); obj_t.interface_type_memberships; end
|
73
73
|
def arguments(owner, ctx); owner.arguments(ctx); end
|
74
74
|
def loadable?(type, ctx); type.visible?(ctx); end
|
75
|
+
def loadable_possible_types(type, ctx); type.possible_types(ctx); end
|
75
76
|
def visibility_profile
|
76
77
|
@visibility_profile ||= Warden::VisibilityProfile.new(self)
|
77
78
|
end
|
@@ -106,6 +107,7 @@ module GraphQL
|
|
106
107
|
def get_field(parent_type, field_name); @schema.get_field(parent_type, field_name); end
|
107
108
|
def reachable_type?(type_name); true; end
|
108
109
|
def loadable?(type, _ctx); true; end
|
110
|
+
def loadable_possible_types(union_type, _ctx); union_type.possible_types; end
|
109
111
|
def reachable_types; @schema.types.values; end # rubocop:disable Development/ContextIsPassedCop
|
110
112
|
def possible_types(type_defn); @schema.possible_types(type_defn, Query::NullContext.instance, false); end
|
111
113
|
def interfaces(obj_type); obj_type.interfaces; end
|
@@ -180,6 +182,10 @@ module GraphQL
|
|
180
182
|
@warden.loadable?(t, ctx)
|
181
183
|
end
|
182
184
|
|
185
|
+
def loadable_possible_types(t, ctx)
|
186
|
+
@warden.loadable_possible_types(t, ctx)
|
187
|
+
end
|
188
|
+
|
183
189
|
def reachable_type?(type_name)
|
184
190
|
!!@warden.reachable_type?(type_name)
|
185
191
|
end
|
@@ -204,7 +210,7 @@ module GraphQL
|
|
204
210
|
@visible_possible_types = @visible_fields = @visible_arguments = @visible_enum_arrays =
|
205
211
|
@visible_enum_values = @visible_interfaces = @type_visibility = @type_memberships =
|
206
212
|
@visible_and_reachable_type = @unions = @unfiltered_interfaces =
|
207
|
-
@reachable_type_set = @visibility_profile =
|
213
|
+
@reachable_type_set = @visibility_profile = @loadable_possible_types =
|
208
214
|
nil
|
209
215
|
@skip_warning = schema.plugins.any? { |(plugin, _opts)| plugin == GraphQL::Schema::Warden }
|
210
216
|
end
|
@@ -229,6 +235,13 @@ module GraphQL
|
|
229
235
|
!reachable_type_set.include?(type) && visible_type?(type)
|
230
236
|
end
|
231
237
|
|
238
|
+
def loadable_possible_types(union_type, _ctx)
|
239
|
+
@loadable_possible_types ||= read_through do |t|
|
240
|
+
t.possible_types # unfiltered
|
241
|
+
end
|
242
|
+
@loadable_possible_types[union_type]
|
243
|
+
end
|
244
|
+
|
232
245
|
# @return [GraphQL::BaseType, nil] The type named `type_name`, if it exists (else `nil`)
|
233
246
|
def get_type(type_name)
|
234
247
|
@visible_types ||= read_through do |name|
|
data/lib/graphql/schema.rb
CHANGED
@@ -75,6 +75,9 @@ module GraphQL
|
|
75
75
|
class Schema
|
76
76
|
extend GraphQL::Schema::Member::HasAstNode
|
77
77
|
extend GraphQL::Schema::FindInheritedValue
|
78
|
+
extend Autoload
|
79
|
+
|
80
|
+
autoload :BUILT_IN_TYPES, "graphql/schema/built_in_types"
|
78
81
|
|
79
82
|
class DuplicateNamesError < GraphQL::Error
|
80
83
|
attr_reader :duplicated_name
|
@@ -1805,6 +1808,5 @@ module GraphQL
|
|
1805
1808
|
end
|
1806
1809
|
end
|
1807
1810
|
|
1808
|
-
require "graphql/schema/built_in_types"
|
1809
1811
|
require "graphql/schema/loader"
|
1810
1812
|
require "graphql/schema/printer"
|
data/lib/graphql/version.rb
CHANGED
data/lib/graphql.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.4.
|
4
|
+
version: 2.4.6
|
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-12-
|
11
|
+
date: 2024-12-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: base64
|