graphql 2.4.5 → 2.4.7
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/autoload.rb +1 -0
- data/lib/graphql/railtie.rb +1 -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 -3
- data/lib/graphql/subscriptions/serialize.rb +2 -0
- data/lib/graphql/version.rb +1 -1
- data/lib/graphql.rb +1 -29
- 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: 69f8b4084adf0530a973073bcacf76e536975b385e4927525504b648762e496e
|
4
|
+
data.tar.gz: ef8e532575d445e0e96c1e5cccb2f6518d4a8759127ba8f27fd4d2aca4ef877a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c9522e680f06a1810e019c64656fba5dd7d7d95e098f136e2f656837c928829eab7a1be5656c7c4c9fd68bf8f262ca9b7ed415d87c12997dc613c9f600e8994b
|
7
|
+
data.tar.gz: 99a5a17272d80d555c98f8f091799e5b84656bfd42310e79d64b65140c7b2786e9f23f4759dfefb5b09c8ffc913349bfd0db3bcff5f6475087b350122aadd066
|
data/lib/graphql/autoload.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module GraphQL
|
4
|
+
# @see GraphQL::Railtie for automatic Rails integration
|
4
5
|
module Autoload
|
5
6
|
# Register a constant named `const_name` to be loaded from `path`.
|
6
7
|
# This is like `Kernel#autoload` but it tracks the constants so they can be eager-loaded with {#eager_load!}
|
data/lib/graphql/railtie.rb
CHANGED
@@ -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
@@ -47,8 +47,6 @@ require "graphql/schema/relay_classic_mutation"
|
|
47
47
|
require "graphql/schema/subscription"
|
48
48
|
require "graphql/schema/visibility"
|
49
49
|
|
50
|
-
GraphQL.ensure_eager_load!
|
51
|
-
|
52
50
|
module GraphQL
|
53
51
|
# A GraphQL schema which may be queried with {GraphQL::Query}.
|
54
52
|
#
|
@@ -75,6 +73,9 @@ module GraphQL
|
|
75
73
|
class Schema
|
76
74
|
extend GraphQL::Schema::Member::HasAstNode
|
77
75
|
extend GraphQL::Schema::FindInheritedValue
|
76
|
+
extend Autoload
|
77
|
+
|
78
|
+
autoload :BUILT_IN_TYPES, "graphql/schema/built_in_types"
|
78
79
|
|
79
80
|
class DuplicateNamesError < GraphQL::Error
|
80
81
|
attr_reader :duplicated_name
|
@@ -1805,6 +1806,5 @@ module GraphQL
|
|
1805
1806
|
end
|
1806
1807
|
end
|
1807
1808
|
|
1808
|
-
require "graphql/schema/built_in_types"
|
1809
1809
|
require "graphql/schema/loader"
|
1810
1810
|
require "graphql/schema/printer"
|
data/lib/graphql/version.rb
CHANGED
data/lib/graphql.rb
CHANGED
@@ -15,6 +15,7 @@ module GraphQL
|
|
15
15
|
super
|
16
16
|
Query.eager_load!
|
17
17
|
Types.eager_load!
|
18
|
+
Schema.eager_load!
|
18
19
|
end
|
19
20
|
|
20
21
|
class Error < StandardError
|
@@ -81,35 +82,6 @@ This is probably a bug in GraphQL-Ruby, please report this error on GitHub: http
|
|
81
82
|
class << self
|
82
83
|
# If true, the parser should raise when an integer or float is followed immediately by an identifier (instead of a space or punctuation)
|
83
84
|
attr_accessor :reject_numbers_followed_by_names
|
84
|
-
|
85
|
-
# If `production?` is detected but `eager_load!` wasn't called, emit a warning.
|
86
|
-
# @return [void]
|
87
|
-
def ensure_eager_load!
|
88
|
-
if production? && !eager_loading?
|
89
|
-
warn <<~WARNING
|
90
|
-
GraphQL-Ruby thinks this is a production deployment but didn't eager-load its constants. Address this by:
|
91
|
-
|
92
|
-
- Calling `GraphQL.eager_load!` in a production-only initializer or setup hook
|
93
|
-
- Assign `GraphQL.env = "..."` to something _other_ than `"production"` (for example, `GraphQL.env = "development"`)
|
94
|
-
|
95
|
-
More details: https://graphql-ruby.org/schema/definition#production-considerations
|
96
|
-
WARNING
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
attr_accessor :env
|
101
|
-
|
102
|
-
private
|
103
|
-
|
104
|
-
# Detect whether this is a production deployment or not
|
105
|
-
def production?
|
106
|
-
if env
|
107
|
-
# Manually assigned to production?
|
108
|
-
env == "production"
|
109
|
-
else
|
110
|
-
(detected_env = ENV["RACK_ENV"] || ENV["RAILS_ENV"] || ENV["HANAMI_ENV"] || ENV["APP_ENV"]) && detected_env.to_s.downcase == "production"
|
111
|
-
end
|
112
|
-
end
|
113
85
|
end
|
114
86
|
|
115
87
|
self.reject_numbers_followed_by_names = false
|
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.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: 2024-12-
|
11
|
+
date: 2024-12-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: base64
|