graphql 1.13.14 → 2.0.0
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/analysis/ast/query_complexity.rb +1 -1
 - data/lib/graphql/analysis/ast/query_depth.rb +0 -1
 - data/lib/graphql/analysis/ast/visitor.rb +1 -1
 - data/lib/graphql/analysis/ast.rb +0 -10
 - data/lib/graphql/analysis.rb +0 -7
 - data/lib/graphql/backtrace/table.rb +0 -18
 - data/lib/graphql/backtrace/tracer.rb +1 -2
 - data/lib/graphql/backtrace.rb +2 -8
 - data/lib/graphql/dig.rb +1 -1
 - data/lib/graphql/execution/errors.rb +1 -9
 - data/lib/graphql/execution/interpreter/runtime.rb +2 -9
 - data/lib/graphql/execution/interpreter.rb +0 -22
 - data/lib/graphql/execution/lazy.rb +1 -1
 - data/lib/graphql/execution/lookahead.rb +6 -13
 - data/lib/graphql/execution/multiplex.rb +50 -107
 - data/lib/graphql/execution.rb +11 -3
 - data/lib/graphql/introspection/dynamic_fields.rb +3 -8
 - data/lib/graphql/introspection/entry_points.rb +2 -15
 - data/lib/graphql/language/document_from_schema_definition.rb +0 -17
 - data/lib/graphql/pagination/connections.rb +2 -28
 - data/lib/graphql/query/context.rb +1 -185
 - data/lib/graphql/query/literal_input.rb +8 -13
 - data/lib/graphql/query/validation_pipeline.rb +8 -37
 - data/lib/graphql/query/variables.rb +22 -18
 - data/lib/graphql/query.rb +5 -35
 - data/lib/graphql/railtie.rb +0 -104
 - data/lib/graphql/relay/range_add.rb +0 -4
 - data/lib/graphql/relay.rb +0 -15
 - data/lib/graphql/schema/addition.rb +1 -8
 - data/lib/graphql/schema/argument.rb +1 -25
 - data/lib/graphql/schema/build_from_definition.rb +0 -1
 - data/lib/graphql/schema/directive.rb +0 -21
 - data/lib/graphql/schema/enum.rb +1 -18
 - data/lib/graphql/schema/enum_value.rb +0 -22
 - data/lib/graphql/schema/field.rb +2 -185
 - data/lib/graphql/schema/input_object.rb +9 -56
 - data/lib/graphql/schema/interface.rb +0 -25
 - data/lib/graphql/schema/introspection_system.rb +3 -8
 - data/lib/graphql/schema/late_bound_type.rb +2 -2
 - data/lib/graphql/schema/list.rb +0 -6
 - data/lib/graphql/schema/loader.rb +0 -1
 - data/lib/graphql/schema/member/base_dsl_methods.rb +0 -5
 - data/lib/graphql/schema/member/build_type.rb +4 -6
 - data/lib/graphql/schema/member/has_arguments.rb +14 -18
 - data/lib/graphql/schema/member/has_fields.rb +2 -2
 - data/lib/graphql/schema/member/has_interfaces.rb +0 -2
 - data/lib/graphql/schema/member.rb +0 -6
 - data/lib/graphql/schema/mutation.rb +0 -9
 - data/lib/graphql/schema/non_null.rb +1 -7
 - data/lib/graphql/schema/object.rb +0 -40
 - data/lib/graphql/schema/relay_classic_mutation.rb +17 -28
 - data/lib/graphql/schema/scalar.rb +0 -15
 - data/lib/graphql/schema/union.rb +0 -16
 - data/lib/graphql/schema/warden.rb +1 -1
 - data/lib/graphql/schema/wrapper.rb +0 -5
 - data/lib/graphql/schema.rb +106 -945
 - data/lib/graphql/static_validation/base_visitor.rb +4 -21
 - data/lib/graphql/static_validation/rules/directives_are_in_valid_locations.rb +12 -12
 - data/lib/graphql/static_validation/validator.rb +2 -24
 - data/lib/graphql/static_validation.rb +0 -2
 - data/lib/graphql/subscriptions/default_subscription_resolve_extension.rb +38 -1
 - data/lib/graphql/subscriptions/event.rb +1 -1
 - data/lib/graphql/subscriptions/instrumentation.rb +0 -51
 - data/lib/graphql/subscriptions.rb +4 -13
 - data/lib/graphql/tracing/data_dog_tracing.rb +2 -19
 - data/lib/graphql/tracing/platform_tracing.rb +4 -31
 - data/lib/graphql/tracing.rb +0 -2
 - data/lib/graphql/types/relay/connection_behaviors.rb +2 -6
 - data/lib/graphql/types/relay/default_relay.rb +0 -10
 - data/lib/graphql/types/relay/node_behaviors.rb +5 -1
 - data/lib/graphql/types/relay.rb +0 -2
 - data/lib/graphql/version.rb +1 -1
 - data/lib/graphql.rb +1 -65
 - metadata +6 -132
 - data/lib/graphql/analysis/analyze_query.rb +0 -98
 - data/lib/graphql/analysis/field_usage.rb +0 -45
 - data/lib/graphql/analysis/max_query_complexity.rb +0 -26
 - data/lib/graphql/analysis/max_query_depth.rb +0 -26
 - data/lib/graphql/analysis/query_complexity.rb +0 -88
 - data/lib/graphql/analysis/query_depth.rb +0 -43
 - data/lib/graphql/analysis/reducer_state.rb +0 -48
 - data/lib/graphql/argument.rb +0 -131
 - data/lib/graphql/authorization.rb +0 -82
 - data/lib/graphql/backtrace/legacy_tracer.rb +0 -56
 - data/lib/graphql/backwards_compatibility.rb +0 -61
 - data/lib/graphql/base_type.rb +0 -232
 - data/lib/graphql/boolean_type.rb +0 -2
 - data/lib/graphql/compatibility/execution_specification/counter_schema.rb +0 -53
 - data/lib/graphql/compatibility/execution_specification/specification_schema.rb +0 -200
 - data/lib/graphql/compatibility/execution_specification.rb +0 -436
 - data/lib/graphql/compatibility/lazy_execution_specification/lazy_schema.rb +0 -111
 - data/lib/graphql/compatibility/lazy_execution_specification.rb +0 -215
 - data/lib/graphql/compatibility/query_parser_specification/parse_error_specification.rb +0 -87
 - data/lib/graphql/compatibility/query_parser_specification/query_assertions.rb +0 -79
 - data/lib/graphql/compatibility/query_parser_specification.rb +0 -266
 - data/lib/graphql/compatibility/schema_parser_specification.rb +0 -682
 - data/lib/graphql/compatibility.rb +0 -5
 - data/lib/graphql/define/assign_argument.rb +0 -12
 - data/lib/graphql/define/assign_connection.rb +0 -13
 - data/lib/graphql/define/assign_enum_value.rb +0 -18
 - data/lib/graphql/define/assign_global_id_field.rb +0 -11
 - data/lib/graphql/define/assign_mutation_function.rb +0 -34
 - data/lib/graphql/define/assign_object_field.rb +0 -42
 - data/lib/graphql/define/defined_object_proxy.rb +0 -53
 - data/lib/graphql/define/instance_definable.rb +0 -255
 - data/lib/graphql/define/no_definition_error.rb +0 -7
 - data/lib/graphql/define/non_null_with_bang.rb +0 -16
 - data/lib/graphql/define/type_definer.rb +0 -31
 - data/lib/graphql/define.rb +0 -31
 - data/lib/graphql/deprecated_dsl.rb +0 -55
 - data/lib/graphql/directive/deprecated_directive.rb +0 -2
 - data/lib/graphql/directive/include_directive.rb +0 -2
 - data/lib/graphql/directive/skip_directive.rb +0 -2
 - data/lib/graphql/directive.rb +0 -107
 - data/lib/graphql/enum_type.rb +0 -133
 - data/lib/graphql/execution/execute.rb +0 -333
 - data/lib/graphql/execution/flatten.rb +0 -40
 - data/lib/graphql/execution/typecast.rb +0 -50
 - data/lib/graphql/field/resolve.rb +0 -59
 - data/lib/graphql/field.rb +0 -226
 - data/lib/graphql/float_type.rb +0 -2
 - data/lib/graphql/function.rb +0 -128
 - data/lib/graphql/id_type.rb +0 -2
 - data/lib/graphql/input_object_type.rb +0 -138
 - data/lib/graphql/int_type.rb +0 -2
 - data/lib/graphql/interface_type.rb +0 -72
 - data/lib/graphql/internal_representation/document.rb +0 -27
 - data/lib/graphql/internal_representation/node.rb +0 -206
 - data/lib/graphql/internal_representation/print.rb +0 -51
 - data/lib/graphql/internal_representation/rewrite.rb +0 -184
 - data/lib/graphql/internal_representation/scope.rb +0 -88
 - data/lib/graphql/internal_representation/visit.rb +0 -36
 - data/lib/graphql/internal_representation.rb +0 -7
 - data/lib/graphql/list_type.rb +0 -80
 - data/lib/graphql/non_null_type.rb +0 -71
 - data/lib/graphql/object_type.rb +0 -130
 - data/lib/graphql/query/arguments.rb +0 -189
 - data/lib/graphql/query/arguments_cache.rb +0 -24
 - data/lib/graphql/query/executor.rb +0 -52
 - data/lib/graphql/query/serial_execution/field_resolution.rb +0 -92
 - data/lib/graphql/query/serial_execution/operation_resolution.rb +0 -19
 - data/lib/graphql/query/serial_execution/selection_resolution.rb +0 -23
 - data/lib/graphql/query/serial_execution/value_resolution.rb +0 -87
 - data/lib/graphql/query/serial_execution.rb +0 -40
 - data/lib/graphql/relay/array_connection.rb +0 -83
 - data/lib/graphql/relay/base_connection.rb +0 -189
 - data/lib/graphql/relay/connection_instrumentation.rb +0 -54
 - data/lib/graphql/relay/connection_resolve.rb +0 -43
 - data/lib/graphql/relay/connection_type.rb +0 -54
 - data/lib/graphql/relay/edge.rb +0 -27
 - data/lib/graphql/relay/edge_type.rb +0 -19
 - data/lib/graphql/relay/edges_instrumentation.rb +0 -39
 - data/lib/graphql/relay/global_id_resolve.rb +0 -17
 - data/lib/graphql/relay/mongo_relation_connection.rb +0 -50
 - data/lib/graphql/relay/mutation/instrumentation.rb +0 -23
 - data/lib/graphql/relay/mutation/resolve.rb +0 -56
 - data/lib/graphql/relay/mutation/result.rb +0 -38
 - data/lib/graphql/relay/mutation.rb +0 -106
 - data/lib/graphql/relay/node.rb +0 -39
 - data/lib/graphql/relay/page_info.rb +0 -7
 - data/lib/graphql/relay/relation_connection.rb +0 -188
 - data/lib/graphql/relay/type_extensions.rb +0 -32
 - data/lib/graphql/scalar_type.rb +0 -91
 - data/lib/graphql/schema/catchall_middleware.rb +0 -35
 - data/lib/graphql/schema/default_parse_error.rb +0 -10
 - data/lib/graphql/schema/default_type_error.rb +0 -17
 - data/lib/graphql/schema/member/accepts_definition.rb +0 -164
 - data/lib/graphql/schema/member/cached_graphql_definition.rb +0 -58
 - data/lib/graphql/schema/member/instrumentation.rb +0 -131
 - data/lib/graphql/schema/middleware_chain.rb +0 -82
 - data/lib/graphql/schema/possible_types.rb +0 -44
 - data/lib/graphql/schema/rescue_middleware.rb +0 -60
 - data/lib/graphql/schema/timeout_middleware.rb +0 -88
 - data/lib/graphql/schema/traversal.rb +0 -228
 - data/lib/graphql/schema/validation.rb +0 -313
 - data/lib/graphql/static_validation/default_visitor.rb +0 -15
 - data/lib/graphql/static_validation/no_validate_visitor.rb +0 -10
 - data/lib/graphql/string_type.rb +0 -2
 - data/lib/graphql/subscriptions/subscription_root.rb +0 -76
 - data/lib/graphql/tracing/opentelemetry_tracing.rb +0 -101
 - data/lib/graphql/tracing/skylight_tracing.rb +0 -70
 - data/lib/graphql/types/relay/node_field.rb +0 -24
 - data/lib/graphql/types/relay/nodes_field.rb +0 -43
 - data/lib/graphql/union_type.rb +0 -115
 - data/lib/graphql/upgrader/member.rb +0 -937
 - data/lib/graphql/upgrader/schema.rb +0 -38
 
| 
         @@ -1,59 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # frozen_string_literal: true
         
     | 
| 
       2 
     | 
    
         
            -
            module GraphQL
         
     | 
| 
       3 
     | 
    
         
            -
              class Field
         
     | 
| 
       4 
     | 
    
         
            -
                # Create resolve procs ahead of time based on a {GraphQL::Field}'s `name`, `property`, and `hash_key` configuration.
         
     | 
| 
       5 
     | 
    
         
            -
                module Resolve
         
     | 
| 
       6 
     | 
    
         
            -
                  module_function
         
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
                  # @param field [GraphQL::Field] A field that needs a resolve proc
         
     | 
| 
       9 
     | 
    
         
            -
                  # @return [Proc] A resolver for this field, based on its config
         
     | 
| 
       10 
     | 
    
         
            -
                  def create_proc(field)
         
     | 
| 
       11 
     | 
    
         
            -
                    if field.property
         
     | 
| 
       12 
     | 
    
         
            -
                      MethodResolve.new(field)
         
     | 
| 
       13 
     | 
    
         
            -
                    elsif !field.hash_key.nil?
         
     | 
| 
       14 
     | 
    
         
            -
                      HashKeyResolve.new(field.hash_key)
         
     | 
| 
       15 
     | 
    
         
            -
                    else
         
     | 
| 
       16 
     | 
    
         
            -
                      NameResolve.new(field)
         
     | 
| 
       17 
     | 
    
         
            -
                    end
         
     | 
| 
       18 
     | 
    
         
            -
                  end
         
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
                  # These only require `obj` as input
         
     | 
| 
       21 
     | 
    
         
            -
                  class BuiltInResolve
         
     | 
| 
       22 
     | 
    
         
            -
                  end
         
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
                  # Resolve the field by `public_send`ing `@method_name`
         
     | 
| 
       25 
     | 
    
         
            -
                  class MethodResolve < BuiltInResolve
         
     | 
| 
       26 
     | 
    
         
            -
                    def initialize(field)
         
     | 
| 
       27 
     | 
    
         
            -
                      @method_name = field.property.to_sym
         
     | 
| 
       28 
     | 
    
         
            -
                    end
         
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
       30 
     | 
    
         
            -
                    def call(obj, args, ctx)
         
     | 
| 
       31 
     | 
    
         
            -
                      obj.public_send(@method_name)
         
     | 
| 
       32 
     | 
    
         
            -
                    end
         
     | 
| 
       33 
     | 
    
         
            -
                  end
         
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
       35 
     | 
    
         
            -
                  # Resolve the field by looking up `@hash_key` with `#[]`
         
     | 
| 
       36 
     | 
    
         
            -
                  class HashKeyResolve < BuiltInResolve
         
     | 
| 
       37 
     | 
    
         
            -
                    def initialize(hash_key)
         
     | 
| 
       38 
     | 
    
         
            -
                      @hash_key = hash_key
         
     | 
| 
       39 
     | 
    
         
            -
                    end
         
     | 
| 
       40 
     | 
    
         
            -
             
     | 
| 
       41 
     | 
    
         
            -
                    def call(obj, args, ctx)
         
     | 
| 
       42 
     | 
    
         
            -
                      obj[@hash_key]
         
     | 
| 
       43 
     | 
    
         
            -
                    end
         
     | 
| 
       44 
     | 
    
         
            -
                  end
         
     | 
| 
       45 
     | 
    
         
            -
             
     | 
| 
       46 
     | 
    
         
            -
                  # Call the field's name at query-time since
         
     | 
| 
       47 
     | 
    
         
            -
                  # it might have changed
         
     | 
| 
       48 
     | 
    
         
            -
                  class NameResolve < BuiltInResolve
         
     | 
| 
       49 
     | 
    
         
            -
                    def initialize(field)
         
     | 
| 
       50 
     | 
    
         
            -
                      @field = field
         
     | 
| 
       51 
     | 
    
         
            -
                    end
         
     | 
| 
       52 
     | 
    
         
            -
             
     | 
| 
       53 
     | 
    
         
            -
                    def call(obj, args, ctx)
         
     | 
| 
       54 
     | 
    
         
            -
                      obj.public_send(@field.name)
         
     | 
| 
       55 
     | 
    
         
            -
                    end
         
     | 
| 
       56 
     | 
    
         
            -
                  end
         
     | 
| 
       57 
     | 
    
         
            -
                end
         
     | 
| 
       58 
     | 
    
         
            -
              end
         
     | 
| 
       59 
     | 
    
         
            -
            end
         
     | 
    
        data/lib/graphql/field.rb
    DELETED
    
    | 
         @@ -1,226 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # frozen_string_literal: true
         
     | 
| 
       2 
     | 
    
         
            -
            require "graphql/field/resolve"
         
     | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
     | 
    
         
            -
            module GraphQL
         
     | 
| 
       5 
     | 
    
         
            -
              # @api deprecated
         
     | 
| 
       6 
     | 
    
         
            -
              class Field
         
     | 
| 
       7 
     | 
    
         
            -
                include GraphQL::Define::InstanceDefinable
         
     | 
| 
       8 
     | 
    
         
            -
                deprecated_accepts_definitions :name, :description, :deprecation_reason,
         
     | 
| 
       9 
     | 
    
         
            -
                  :resolve, :lazy_resolve,
         
     | 
| 
       10 
     | 
    
         
            -
                  :type, :arguments,
         
     | 
| 
       11 
     | 
    
         
            -
                  :property, :hash_key, :complexity,
         
     | 
| 
       12 
     | 
    
         
            -
                  :mutation, :function,
         
     | 
| 
       13 
     | 
    
         
            -
                  :edge_class,
         
     | 
| 
       14 
     | 
    
         
            -
                  :relay_node_field,
         
     | 
| 
       15 
     | 
    
         
            -
                  :relay_nodes_field,
         
     | 
| 
       16 
     | 
    
         
            -
                  :subscription_scope,
         
     | 
| 
       17 
     | 
    
         
            -
                  :trace,
         
     | 
| 
       18 
     | 
    
         
            -
                  :introspection,
         
     | 
| 
       19 
     | 
    
         
            -
                  argument: GraphQL::Define::AssignArgument
         
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
                ensure_defined(
         
     | 
| 
       22 
     | 
    
         
            -
                  :name, :deprecation_reason, :description, :description=, :property, :hash_key,
         
     | 
| 
       23 
     | 
    
         
            -
                  :mutation, :arguments, :complexity, :function,
         
     | 
| 
       24 
     | 
    
         
            -
                  :resolve, :resolve=, :lazy_resolve, :lazy_resolve=, :lazy_resolve_proc, :resolve_proc,
         
     | 
| 
       25 
     | 
    
         
            -
                  :type, :type=, :name=, :property=, :hash_key=,
         
     | 
| 
       26 
     | 
    
         
            -
                  :relay_node_field, :relay_nodes_field, :edges?, :edge_class, :subscription_scope,
         
     | 
| 
       27 
     | 
    
         
            -
                  :introspection?
         
     | 
| 
       28 
     | 
    
         
            -
                )
         
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
       30 
     | 
    
         
            -
                # @return [Boolean] True if this is the Relay find-by-id field
         
     | 
| 
       31 
     | 
    
         
            -
                attr_accessor :relay_node_field
         
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
       33 
     | 
    
         
            -
                # @return [Boolean] True if this is the Relay find-by-ids field
         
     | 
| 
       34 
     | 
    
         
            -
                attr_accessor :relay_nodes_field
         
     | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
       36 
     | 
    
         
            -
                # @return [<#call(obj, args, ctx)>] A proc-like object which can be called to return the field's value
         
     | 
| 
       37 
     | 
    
         
            -
                attr_reader :resolve_proc
         
     | 
| 
       38 
     | 
    
         
            -
             
     | 
| 
       39 
     | 
    
         
            -
                # @return [<#call(obj, args, ctx)>] A proc-like object which can be called trigger a lazy resolution
         
     | 
| 
       40 
     | 
    
         
            -
                attr_reader :lazy_resolve_proc
         
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
       42 
     | 
    
         
            -
                # @return [String] The name of this field on its {GraphQL::ObjectType} (or {GraphQL::InterfaceType})
         
     | 
| 
       43 
     | 
    
         
            -
                attr_reader :name
         
     | 
| 
       44 
     | 
    
         
            -
                alias :graphql_name :name
         
     | 
| 
       45 
     | 
    
         
            -
             
     | 
| 
       46 
     | 
    
         
            -
                # @return [String, nil] The client-facing description of this field
         
     | 
| 
       47 
     | 
    
         
            -
                attr_accessor :description
         
     | 
| 
       48 
     | 
    
         
            -
             
     | 
| 
       49 
     | 
    
         
            -
                # @return [String, nil] The client-facing reason why this field is deprecated (if present, the field is deprecated)
         
     | 
| 
       50 
     | 
    
         
            -
                attr_accessor :deprecation_reason
         
     | 
| 
       51 
     | 
    
         
            -
             
     | 
| 
       52 
     | 
    
         
            -
                # @return [Hash<String => GraphQL::Argument>] Map String argument names to their {GraphQL::Argument} implementations
         
     | 
| 
       53 
     | 
    
         
            -
                attr_accessor :arguments
         
     | 
| 
       54 
     | 
    
         
            -
             
     | 
| 
       55 
     | 
    
         
            -
                # @return [GraphQL::Relay::Mutation, nil] The mutation this field was derived from, if it was derived from a mutation
         
     | 
| 
       56 
     | 
    
         
            -
                attr_accessor :mutation
         
     | 
| 
       57 
     | 
    
         
            -
             
     | 
| 
       58 
     | 
    
         
            -
                # @return [Numeric, Proc] The complexity for this field (default: 1), as a constant or a proc like `->(query_ctx, args, child_complexity) { } # Numeric`
         
     | 
| 
       59 
     | 
    
         
            -
                attr_accessor :complexity
         
     | 
| 
       60 
     | 
    
         
            -
             
     | 
| 
       61 
     | 
    
         
            -
                # @return [Symbol, nil] The method to call on `obj` to return this field (overrides {#name} if present)
         
     | 
| 
       62 
     | 
    
         
            -
                attr_reader :property
         
     | 
| 
       63 
     | 
    
         
            -
             
     | 
| 
       64 
     | 
    
         
            -
                # @return [Object, nil] The key to access with `obj.[]` to resolve this field (overrides {#name} if present)
         
     | 
| 
       65 
     | 
    
         
            -
                attr_reader :hash_key
         
     | 
| 
       66 
     | 
    
         
            -
             
     | 
| 
       67 
     | 
    
         
            -
                # @return [Object, GraphQL::Function] The function used to derive this field
         
     | 
| 
       68 
     | 
    
         
            -
                attr_accessor :function
         
     | 
| 
       69 
     | 
    
         
            -
             
     | 
| 
       70 
     | 
    
         
            -
                attr_accessor :arguments_class
         
     | 
| 
       71 
     | 
    
         
            -
             
     | 
| 
       72 
     | 
    
         
            -
                attr_writer :connection
         
     | 
| 
       73 
     | 
    
         
            -
                attr_writer :introspection
         
     | 
| 
       74 
     | 
    
         
            -
             
     | 
| 
       75 
     | 
    
         
            -
                # @return [nil, String] Prefix for subscription names from this field
         
     | 
| 
       76 
     | 
    
         
            -
                attr_accessor :subscription_scope
         
     | 
| 
       77 
     | 
    
         
            -
             
     | 
| 
       78 
     | 
    
         
            -
                # @return [Boolean] True if this field should be traced. By default, fields are only traced if they are not a ScalarType or EnumType.
         
     | 
| 
       79 
     | 
    
         
            -
                attr_accessor :trace
         
     | 
| 
       80 
     | 
    
         
            -
             
     | 
| 
       81 
     | 
    
         
            -
                attr_accessor :ast_node
         
     | 
| 
       82 
     | 
    
         
            -
             
     | 
| 
       83 
     | 
    
         
            -
                # Future-compatible alias
         
     | 
| 
       84 
     | 
    
         
            -
                # @see {GraphQL::SchemaMember}
         
     | 
| 
       85 
     | 
    
         
            -
                alias :graphql_definition :itself
         
     | 
| 
       86 
     | 
    
         
            -
             
     | 
| 
       87 
     | 
    
         
            -
                # @return [Boolean]
         
     | 
| 
       88 
     | 
    
         
            -
                def connection?
         
     | 
| 
       89 
     | 
    
         
            -
                  @connection
         
     | 
| 
       90 
     | 
    
         
            -
                end
         
     | 
| 
       91 
     | 
    
         
            -
             
     | 
| 
       92 
     | 
    
         
            -
                # @return [nil, Class]
         
     | 
| 
       93 
     | 
    
         
            -
                # @api private
         
     | 
| 
       94 
     | 
    
         
            -
                attr_accessor :edge_class
         
     | 
| 
       95 
     | 
    
         
            -
             
     | 
| 
       96 
     | 
    
         
            -
                # @return [Boolean]
         
     | 
| 
       97 
     | 
    
         
            -
                def edges?
         
     | 
| 
       98 
     | 
    
         
            -
                  !!@edge_class
         
     | 
| 
       99 
     | 
    
         
            -
                end
         
     | 
| 
       100 
     | 
    
         
            -
             
     | 
| 
       101 
     | 
    
         
            -
                # @return [nil, Integer]
         
     | 
| 
       102 
     | 
    
         
            -
                attr_accessor :connection_max_page_size
         
     | 
| 
       103 
     | 
    
         
            -
             
     | 
| 
       104 
     | 
    
         
            -
                def initialize
         
     | 
| 
       105 
     | 
    
         
            -
                  @complexity = 1
         
     | 
| 
       106 
     | 
    
         
            -
                  @arguments = {}
         
     | 
| 
       107 
     | 
    
         
            -
                  @resolve_proc = build_default_resolver
         
     | 
| 
       108 
     | 
    
         
            -
                  @lazy_resolve_proc = DefaultLazyResolve
         
     | 
| 
       109 
     | 
    
         
            -
                  @relay_node_field = false
         
     | 
| 
       110 
     | 
    
         
            -
                  @connection = false
         
     | 
| 
       111 
     | 
    
         
            -
                  @connection_max_page_size = nil
         
     | 
| 
       112 
     | 
    
         
            -
                  @edge_class = nil
         
     | 
| 
       113 
     | 
    
         
            -
                  @trace = nil
         
     | 
| 
       114 
     | 
    
         
            -
                  @introspection = false
         
     | 
| 
       115 
     | 
    
         
            -
                end
         
     | 
| 
       116 
     | 
    
         
            -
             
     | 
| 
       117 
     | 
    
         
            -
                def initialize_copy(other)
         
     | 
| 
       118 
     | 
    
         
            -
                  ensure_defined
         
     | 
| 
       119 
     | 
    
         
            -
                  super
         
     | 
| 
       120 
     | 
    
         
            -
                  @arguments = other.arguments.dup
         
     | 
| 
       121 
     | 
    
         
            -
                end
         
     | 
| 
       122 
     | 
    
         
            -
             
     | 
| 
       123 
     | 
    
         
            -
                # @return [Boolean] Is this field a predefined introspection field?
         
     | 
| 
       124 
     | 
    
         
            -
                def introspection?
         
     | 
| 
       125 
     | 
    
         
            -
                  @introspection
         
     | 
| 
       126 
     | 
    
         
            -
                end
         
     | 
| 
       127 
     | 
    
         
            -
             
     | 
| 
       128 
     | 
    
         
            -
                # Get a value for this field
         
     | 
| 
       129 
     | 
    
         
            -
                # @example resolving a field value
         
     | 
| 
       130 
     | 
    
         
            -
                #   field.resolve(obj, args, ctx)
         
     | 
| 
       131 
     | 
    
         
            -
                #
         
     | 
| 
       132 
     | 
    
         
            -
                # @param object [Object] The object this field belongs to
         
     | 
| 
       133 
     | 
    
         
            -
                # @param arguments [Hash] Arguments declared in the query
         
     | 
| 
       134 
     | 
    
         
            -
                # @param context [GraphQL::Query::Context]
         
     | 
| 
       135 
     | 
    
         
            -
                def resolve(object, arguments, context)
         
     | 
| 
       136 
     | 
    
         
            -
                  resolve_proc.call(object, arguments, context)
         
     | 
| 
       137 
     | 
    
         
            -
                end
         
     | 
| 
       138 
     | 
    
         
            -
             
     | 
| 
       139 
     | 
    
         
            -
                # Provide a new callable for this field's resolve function. If `nil`,
         
     | 
| 
       140 
     | 
    
         
            -
                # a new resolve proc will be build based on its {#name}, {#property} or {#hash_key}.
         
     | 
| 
       141 
     | 
    
         
            -
                # @param new_resolve_proc [<#call(obj, args, ctx)>, nil]
         
     | 
| 
       142 
     | 
    
         
            -
                def resolve=(new_resolve_proc)
         
     | 
| 
       143 
     | 
    
         
            -
                  @resolve_proc = new_resolve_proc || build_default_resolver
         
     | 
| 
       144 
     | 
    
         
            -
                end
         
     | 
| 
       145 
     | 
    
         
            -
             
     | 
| 
       146 
     | 
    
         
            -
                def type=(new_return_type)
         
     | 
| 
       147 
     | 
    
         
            -
                  @clean_type = nil
         
     | 
| 
       148 
     | 
    
         
            -
                  @dirty_type = new_return_type
         
     | 
| 
       149 
     | 
    
         
            -
                end
         
     | 
| 
       150 
     | 
    
         
            -
             
     | 
| 
       151 
     | 
    
         
            -
                # Get the return type for this field.
         
     | 
| 
       152 
     | 
    
         
            -
                def type
         
     | 
| 
       153 
     | 
    
         
            -
                  @clean_type ||= GraphQL::BaseType.resolve_related_type(@dirty_type)
         
     | 
| 
       154 
     | 
    
         
            -
                end
         
     | 
| 
       155 
     | 
    
         
            -
             
     | 
| 
       156 
     | 
    
         
            -
                def name=(new_name)
         
     | 
| 
       157 
     | 
    
         
            -
                  old_name = defined?(@name) ? @name : nil
         
     | 
| 
       158 
     | 
    
         
            -
                  @name = new_name
         
     | 
| 
       159 
     | 
    
         
            -
             
     | 
| 
       160 
     | 
    
         
            -
                  if old_name != new_name && @resolve_proc.is_a?(Field::Resolve::NameResolve)
         
     | 
| 
       161 
     | 
    
         
            -
                    # Since the NameResolve would use the old field name,
         
     | 
| 
       162 
     | 
    
         
            -
                    # reset resolve proc when the name has changed
         
     | 
| 
       163 
     | 
    
         
            -
                    self.resolve = nil
         
     | 
| 
       164 
     | 
    
         
            -
                  end
         
     | 
| 
       165 
     | 
    
         
            -
                end
         
     | 
| 
       166 
     | 
    
         
            -
             
     | 
| 
       167 
     | 
    
         
            -
                # @param new_property [Symbol] A method to call to resolve this field. Overrides the existing resolve proc.
         
     | 
| 
       168 
     | 
    
         
            -
                def property=(new_property)
         
     | 
| 
       169 
     | 
    
         
            -
                  @property = new_property
         
     | 
| 
       170 
     | 
    
         
            -
                  self.resolve = nil # reset resolve proc
         
     | 
| 
       171 
     | 
    
         
            -
                end
         
     | 
| 
       172 
     | 
    
         
            -
             
     | 
| 
       173 
     | 
    
         
            -
                # @param new_hash_key [Symbol] A key to access with `#[key]` to resolve this field. Overrides the existing resolve proc.
         
     | 
| 
       174 
     | 
    
         
            -
                def hash_key=(new_hash_key)
         
     | 
| 
       175 
     | 
    
         
            -
                  @hash_key = new_hash_key
         
     | 
| 
       176 
     | 
    
         
            -
                  self.resolve = nil # reset resolve proc
         
     | 
| 
       177 
     | 
    
         
            -
                end
         
     | 
| 
       178 
     | 
    
         
            -
             
     | 
| 
       179 
     | 
    
         
            -
                def to_s
         
     | 
| 
       180 
     | 
    
         
            -
                  "<Field name:#{name || "not-named"} desc:#{description} resolve:#{resolve_proc}>"
         
     | 
| 
       181 
     | 
    
         
            -
                end
         
     | 
| 
       182 
     | 
    
         
            -
             
     | 
| 
       183 
     | 
    
         
            -
                # If {#resolve} returned an object which should be handled lazily,
         
     | 
| 
       184 
     | 
    
         
            -
                # this method will be called later to force the object to return its value.
         
     | 
| 
       185 
     | 
    
         
            -
                # @param obj [Object] The {#resolve}-provided object, registered with {Schema#lazy_resolve}
         
     | 
| 
       186 
     | 
    
         
            -
                # @param args [GraphQL::Query::Arguments] Arguments to this field
         
     | 
| 
       187 
     | 
    
         
            -
                # @param ctx [GraphQL::Query::Context] Context for this field
         
     | 
| 
       188 
     | 
    
         
            -
                # @return [Object] The result of calling the registered method on `obj`
         
     | 
| 
       189 
     | 
    
         
            -
                def lazy_resolve(obj, args, ctx)
         
     | 
| 
       190 
     | 
    
         
            -
                  @lazy_resolve_proc.call(obj, args, ctx)
         
     | 
| 
       191 
     | 
    
         
            -
                end
         
     | 
| 
       192 
     | 
    
         
            -
             
     | 
| 
       193 
     | 
    
         
            -
                # Assign a new resolve proc to this field. Used for {#lazy_resolve}
         
     | 
| 
       194 
     | 
    
         
            -
                def lazy_resolve=(new_lazy_resolve_proc)
         
     | 
| 
       195 
     | 
    
         
            -
                  @lazy_resolve_proc = new_lazy_resolve_proc
         
     | 
| 
       196 
     | 
    
         
            -
                end
         
     | 
| 
       197 
     | 
    
         
            -
             
     | 
| 
       198 
     | 
    
         
            -
                # Prepare a lazy value for this field. It may be `then`-ed and resolved later.
         
     | 
| 
       199 
     | 
    
         
            -
                # @return [GraphQL::Execution::Lazy] A lazy wrapper around `obj` and its registered method name
         
     | 
| 
       200 
     | 
    
         
            -
                def prepare_lazy(obj, args, ctx)
         
     | 
| 
       201 
     | 
    
         
            -
                  GraphQL::Execution::Lazy.new {
         
     | 
| 
       202 
     | 
    
         
            -
                    lazy_resolve(obj, args, ctx)
         
     | 
| 
       203 
     | 
    
         
            -
                  }
         
     | 
| 
       204 
     | 
    
         
            -
                end
         
     | 
| 
       205 
     | 
    
         
            -
             
     | 
| 
       206 
     | 
    
         
            -
                def type_class
         
     | 
| 
       207 
     | 
    
         
            -
                  metadata[:type_class]
         
     | 
| 
       208 
     | 
    
         
            -
                end
         
     | 
| 
       209 
     | 
    
         
            -
             
     | 
| 
       210 
     | 
    
         
            -
                def get_argument(argument_name)
         
     | 
| 
       211 
     | 
    
         
            -
                  arguments[argument_name]
         
     | 
| 
       212 
     | 
    
         
            -
                end
         
     | 
| 
       213 
     | 
    
         
            -
             
     | 
| 
       214 
     | 
    
         
            -
                private
         
     | 
| 
       215 
     | 
    
         
            -
             
     | 
| 
       216 
     | 
    
         
            -
                def build_default_resolver
         
     | 
| 
       217 
     | 
    
         
            -
                  GraphQL::Field::Resolve.create_proc(self)
         
     | 
| 
       218 
     | 
    
         
            -
                end
         
     | 
| 
       219 
     | 
    
         
            -
             
     | 
| 
       220 
     | 
    
         
            -
                module DefaultLazyResolve
         
     | 
| 
       221 
     | 
    
         
            -
                  def self.call(obj, args, ctx)
         
     | 
| 
       222 
     | 
    
         
            -
                    ctx.schema.sync_lazy(obj)
         
     | 
| 
       223 
     | 
    
         
            -
                  end
         
     | 
| 
       224 
     | 
    
         
            -
                end
         
     | 
| 
       225 
     | 
    
         
            -
              end
         
     | 
| 
       226 
     | 
    
         
            -
            end
         
     | 
    
        data/lib/graphql/float_type.rb
    DELETED
    
    
    
        data/lib/graphql/function.rb
    DELETED
    
    | 
         @@ -1,128 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # frozen_string_literal: true
         
     | 
| 
       2 
     | 
    
         
            -
            module GraphQL
         
     | 
| 
       3 
     | 
    
         
            -
              # @api deprecated
         
     | 
| 
       4 
     | 
    
         
            -
              class Function
         
     | 
| 
       5 
     | 
    
         
            -
                def self.inherited(subclass)
         
     | 
| 
       6 
     | 
    
         
            -
                  GraphQL::Deprecation.warn "GraphQL::Function (used for #{subclass}) will be removed from GraphQL-Ruby 2.0, please upgrade to resolvers: https://graphql-ruby.org/fields/resolvers.html"
         
     | 
| 
       7 
     | 
    
         
            -
                end
         
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
                # @return [Hash<String => GraphQL::Argument>] Arguments, keyed by name
         
     | 
| 
       10 
     | 
    
         
            -
                def arguments
         
     | 
| 
       11 
     | 
    
         
            -
                  self.class.arguments
         
     | 
| 
       12 
     | 
    
         
            -
                end
         
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
                # @return [GraphQL::BaseType] Return type
         
     | 
| 
       15 
     | 
    
         
            -
                def type
         
     | 
| 
       16 
     | 
    
         
            -
                  self.class.type
         
     | 
| 
       17 
     | 
    
         
            -
                end
         
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
                # @return [Object] This function's resolver
         
     | 
| 
       20 
     | 
    
         
            -
                def call(obj, args, ctx)
         
     | 
| 
       21 
     | 
    
         
            -
                  raise GraphQL::RequiredImplementationMissingError
         
     | 
| 
       22 
     | 
    
         
            -
                end
         
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
                # @return [String, nil]
         
     | 
| 
       25 
     | 
    
         
            -
                def description
         
     | 
| 
       26 
     | 
    
         
            -
                  self.class.description
         
     | 
| 
       27 
     | 
    
         
            -
                end
         
     | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
       29 
     | 
    
         
            -
                # @return [String, nil]
         
     | 
| 
       30 
     | 
    
         
            -
                def deprecation_reason
         
     | 
| 
       31 
     | 
    
         
            -
                  self.class.deprecation_reason
         
     | 
| 
       32 
     | 
    
         
            -
                end
         
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
       34 
     | 
    
         
            -
                # @return [Integer, Proc]
         
     | 
| 
       35 
     | 
    
         
            -
                def complexity
         
     | 
| 
       36 
     | 
    
         
            -
                  self.class.complexity || 1
         
     | 
| 
       37 
     | 
    
         
            -
                end
         
     | 
| 
       38 
     | 
    
         
            -
             
     | 
| 
       39 
     | 
    
         
            -
                class << self
         
     | 
| 
       40 
     | 
    
         
            -
                  # Define an argument for this function & its subclasses
         
     | 
| 
       41 
     | 
    
         
            -
                  # @see {GraphQL::Field} same arguments as the `argument` definition helper
         
     | 
| 
       42 
     | 
    
         
            -
                  # @return [void]
         
     | 
| 
       43 
     | 
    
         
            -
                  def argument(*args, **kwargs, &block)
         
     | 
| 
       44 
     | 
    
         
            -
                    argument = GraphQL::Argument.from_dsl(*args, **kwargs, &block)
         
     | 
| 
       45 
     | 
    
         
            -
                    own_arguments[argument.name] = argument
         
     | 
| 
       46 
     | 
    
         
            -
                    nil
         
     | 
| 
       47 
     | 
    
         
            -
                  end
         
     | 
| 
       48 
     | 
    
         
            -
             
     | 
| 
       49 
     | 
    
         
            -
                  # @return [Hash<String => GraphQL::Argument>] Arguments for this function class, including inherited arguments
         
     | 
| 
       50 
     | 
    
         
            -
                  def arguments
         
     | 
| 
       51 
     | 
    
         
            -
                    if parent_function?
         
     | 
| 
       52 
     | 
    
         
            -
                      own_arguments.merge(superclass.arguments)
         
     | 
| 
       53 
     | 
    
         
            -
                    else
         
     | 
| 
       54 
     | 
    
         
            -
                      own_arguments.dup
         
     | 
| 
       55 
     | 
    
         
            -
                    end
         
     | 
| 
       56 
     | 
    
         
            -
                  end
         
     | 
| 
       57 
     | 
    
         
            -
             
     | 
| 
       58 
     | 
    
         
            -
                  # Provides shorthand access to GraphQL's built-in types
         
     | 
| 
       59 
     | 
    
         
            -
                  def types
         
     | 
| 
       60 
     | 
    
         
            -
                    GraphQL::Define::TypeDefiner.instance
         
     | 
| 
       61 
     | 
    
         
            -
                  end
         
     | 
| 
       62 
     | 
    
         
            -
             
     | 
| 
       63 
     | 
    
         
            -
                  # Get or set the return type for this function class & descendants
         
     | 
| 
       64 
     | 
    
         
            -
                  # @return [GraphQL::BaseType]
         
     | 
| 
       65 
     | 
    
         
            -
                  def type(premade_type = nil, &block)
         
     | 
| 
       66 
     | 
    
         
            -
                    if block_given?
         
     | 
| 
       67 
     | 
    
         
            -
                      @type = GraphQL::ObjectType.define(&block)
         
     | 
| 
       68 
     | 
    
         
            -
                    elsif premade_type
         
     | 
| 
       69 
     | 
    
         
            -
                      @type = premade_type
         
     | 
| 
       70 
     | 
    
         
            -
                    elsif parent_function?
         
     | 
| 
       71 
     | 
    
         
            -
                      @type || superclass.type
         
     | 
| 
       72 
     | 
    
         
            -
                    else
         
     | 
| 
       73 
     | 
    
         
            -
                      @type
         
     | 
| 
       74 
     | 
    
         
            -
                    end
         
     | 
| 
       75 
     | 
    
         
            -
                  end
         
     | 
| 
       76 
     | 
    
         
            -
             
     | 
| 
       77 
     | 
    
         
            -
                  def build_field(function)
         
     | 
| 
       78 
     | 
    
         
            -
                    GraphQL::Field.define(
         
     | 
| 
       79 
     | 
    
         
            -
                      arguments: function.arguments,
         
     | 
| 
       80 
     | 
    
         
            -
                      complexity: function.complexity,
         
     | 
| 
       81 
     | 
    
         
            -
                      type: function.type,
         
     | 
| 
       82 
     | 
    
         
            -
                      resolve: function,
         
     | 
| 
       83 
     | 
    
         
            -
                      description: function.description,
         
     | 
| 
       84 
     | 
    
         
            -
                      function: function,
         
     | 
| 
       85 
     | 
    
         
            -
                      deprecation_reason: function.deprecation_reason,
         
     | 
| 
       86 
     | 
    
         
            -
                    )
         
     | 
| 
       87 
     | 
    
         
            -
                  end
         
     | 
| 
       88 
     | 
    
         
            -
             
     | 
| 
       89 
     | 
    
         
            -
                  # Class-level reader/writer which is inherited
         
     | 
| 
       90 
     | 
    
         
            -
                  # @api private
         
     | 
| 
       91 
     | 
    
         
            -
                  def self.inherited_value(name)
         
     | 
| 
       92 
     | 
    
         
            -
                    self.class_eval <<-RUBY
         
     | 
| 
       93 
     | 
    
         
            -
                      def #{name}(new_value = nil)
         
     | 
| 
       94 
     | 
    
         
            -
                        if new_value
         
     | 
| 
       95 
     | 
    
         
            -
                          @#{name} = new_value
         
     | 
| 
       96 
     | 
    
         
            -
                        elsif parent_function?
         
     | 
| 
       97 
     | 
    
         
            -
                          @#{name} || superclass.#{name}
         
     | 
| 
       98 
     | 
    
         
            -
                        else
         
     | 
| 
       99 
     | 
    
         
            -
                          @#{name}
         
     | 
| 
       100 
     | 
    
         
            -
                        end
         
     | 
| 
       101 
     | 
    
         
            -
                      end
         
     | 
| 
       102 
     | 
    
         
            -
                    RUBY
         
     | 
| 
       103 
     | 
    
         
            -
                  end
         
     | 
| 
       104 
     | 
    
         
            -
             
     | 
| 
       105 
     | 
    
         
            -
                  # @!method description(new_value = nil)
         
     | 
| 
       106 
     | 
    
         
            -
                  #   Get or set this class's description
         
     | 
| 
       107 
     | 
    
         
            -
                  inherited_value(:description)
         
     | 
| 
       108 
     | 
    
         
            -
                  # @!method deprecation_reason(new_value = nil)
         
     | 
| 
       109 
     | 
    
         
            -
                  #   Get or set this class's deprecation_reason
         
     | 
| 
       110 
     | 
    
         
            -
                  inherited_value(:deprecation_reason)
         
     | 
| 
       111 
     | 
    
         
            -
                  # @!method complexity(new_value = nil)
         
     | 
| 
       112 
     | 
    
         
            -
                  #   Get or set this class's complexity
         
     | 
| 
       113 
     | 
    
         
            -
                  inherited_value(:complexity)
         
     | 
| 
       114 
     | 
    
         
            -
             
     | 
| 
       115 
     | 
    
         
            -
                  private
         
     | 
| 
       116 
     | 
    
         
            -
             
     | 
| 
       117 
     | 
    
         
            -
                  # Does this function inherit from another function?
         
     | 
| 
       118 
     | 
    
         
            -
                  def parent_function?
         
     | 
| 
       119 
     | 
    
         
            -
                    superclass <= GraphQL::Function
         
     | 
| 
       120 
     | 
    
         
            -
                  end
         
     | 
| 
       121 
     | 
    
         
            -
             
     | 
| 
       122 
     | 
    
         
            -
                  # Arguments defined on this class (not superclasses)
         
     | 
| 
       123 
     | 
    
         
            -
                  def own_arguments
         
     | 
| 
       124 
     | 
    
         
            -
                    @own_arguments ||= {}
         
     | 
| 
       125 
     | 
    
         
            -
                  end
         
     | 
| 
       126 
     | 
    
         
            -
                end
         
     | 
| 
       127 
     | 
    
         
            -
              end
         
     | 
| 
       128 
     | 
    
         
            -
            end
         
     | 
    
        data/lib/graphql/id_type.rb
    DELETED
    
    
| 
         @@ -1,138 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # frozen_string_literal: true
         
     | 
| 
       2 
     | 
    
         
            -
            module GraphQL
         
     | 
| 
       3 
     | 
    
         
            -
              # @api deprecated
         
     | 
| 
       4 
     | 
    
         
            -
              class InputObjectType < GraphQL::BaseType
         
     | 
| 
       5 
     | 
    
         
            -
                extend Define::InstanceDefinable::DeprecatedDefine
         
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
                deprecated_accepts_definitions(
         
     | 
| 
       8 
     | 
    
         
            -
                  :arguments, :mutation,
         
     | 
| 
       9 
     | 
    
         
            -
                  input_field: GraphQL::Define::AssignArgument,
         
     | 
| 
       10 
     | 
    
         
            -
                  argument: GraphQL::Define::AssignArgument
         
     | 
| 
       11 
     | 
    
         
            -
                )
         
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
                attr_accessor :mutation, :arguments, :arguments_class
         
     | 
| 
       14 
     | 
    
         
            -
                ensure_defined(:mutation, :arguments, :input_fields)
         
     | 
| 
       15 
     | 
    
         
            -
                alias :input_fields :arguments
         
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
                # @!attribute mutation
         
     | 
| 
       18 
     | 
    
         
            -
                #   @return [GraphQL::Relay::Mutation, nil] The mutation this field was derived from, if it was derived from a mutation
         
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
                # @!attribute arguments
         
     | 
| 
       21 
     | 
    
         
            -
                # @return [Hash<String => GraphQL::Argument>] Map String argument names to their {GraphQL::Argument} implementations
         
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
                def initialize
         
     | 
| 
       25 
     | 
    
         
            -
                  super
         
     | 
| 
       26 
     | 
    
         
            -
                  @arguments = {}
         
     | 
| 
       27 
     | 
    
         
            -
                end
         
     | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
       29 
     | 
    
         
            -
                def initialize_copy(other)
         
     | 
| 
       30 
     | 
    
         
            -
                  super
         
     | 
| 
       31 
     | 
    
         
            -
                  @arguments = other.arguments.dup
         
     | 
| 
       32 
     | 
    
         
            -
                end
         
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
       34 
     | 
    
         
            -
                def kind
         
     | 
| 
       35 
     | 
    
         
            -
                  GraphQL::TypeKinds::INPUT_OBJECT
         
     | 
| 
       36 
     | 
    
         
            -
                end
         
     | 
| 
       37 
     | 
    
         
            -
             
     | 
| 
       38 
     | 
    
         
            -
                def coerce_result(value, ctx = nil)
         
     | 
| 
       39 
     | 
    
         
            -
                  if ctx.nil?
         
     | 
| 
       40 
     | 
    
         
            -
                    warn_deprecated_coerce("coerce_isolated_result")
         
     | 
| 
       41 
     | 
    
         
            -
                    ctx = GraphQL::Query::NullContext
         
     | 
| 
       42 
     | 
    
         
            -
                  end
         
     | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
       44 
     | 
    
         
            -
                  # Allow the application to provide values as :symbols, and convert them to the strings
         
     | 
| 
       45 
     | 
    
         
            -
                  value = value.reduce({}) { |memo, (k, v)| memo[k.to_s] = v; memo }
         
     | 
| 
       46 
     | 
    
         
            -
             
     | 
| 
       47 
     | 
    
         
            -
                  result = {}
         
     | 
| 
       48 
     | 
    
         
            -
             
     | 
| 
       49 
     | 
    
         
            -
                  arguments.each do |input_key, input_field_defn|
         
     | 
| 
       50 
     | 
    
         
            -
                    input_value = value[input_key]
         
     | 
| 
       51 
     | 
    
         
            -
                    if value.key?(input_key)
         
     | 
| 
       52 
     | 
    
         
            -
                      result[input_key] = if input_value.nil?
         
     | 
| 
       53 
     | 
    
         
            -
                        nil
         
     | 
| 
       54 
     | 
    
         
            -
                      else
         
     | 
| 
       55 
     | 
    
         
            -
                        input_field_defn.type.coerce_result(input_value, ctx)
         
     | 
| 
       56 
     | 
    
         
            -
                      end
         
     | 
| 
       57 
     | 
    
         
            -
                    end
         
     | 
| 
       58 
     | 
    
         
            -
                  end
         
     | 
| 
       59 
     | 
    
         
            -
             
     | 
| 
       60 
     | 
    
         
            -
                  result
         
     | 
| 
       61 
     | 
    
         
            -
                end
         
     | 
| 
       62 
     | 
    
         
            -
             
     | 
| 
       63 
     | 
    
         
            -
                def get_argument(argument_name)
         
     | 
| 
       64 
     | 
    
         
            -
                  arguments[argument_name]
         
     | 
| 
       65 
     | 
    
         
            -
                end
         
     | 
| 
       66 
     | 
    
         
            -
             
     | 
| 
       67 
     | 
    
         
            -
                private
         
     | 
| 
       68 
     | 
    
         
            -
             
     | 
| 
       69 
     | 
    
         
            -
                def coerce_non_null_input(value, ctx)
         
     | 
| 
       70 
     | 
    
         
            -
                  input_values = {}
         
     | 
| 
       71 
     | 
    
         
            -
                  defaults_used = Set.new
         
     | 
| 
       72 
     | 
    
         
            -
             
     | 
| 
       73 
     | 
    
         
            -
                  arguments.each do |input_key, input_field_defn|
         
     | 
| 
       74 
     | 
    
         
            -
                    field_value = value[input_key]
         
     | 
| 
       75 
     | 
    
         
            -
             
     | 
| 
       76 
     | 
    
         
            -
                    if value.key?(input_key)
         
     | 
| 
       77 
     | 
    
         
            -
                      coerced_value = input_field_defn.type.coerce_input(field_value, ctx)
         
     | 
| 
       78 
     | 
    
         
            -
                      input_values[input_key] = input_field_defn.prepare(coerced_value, ctx)
         
     | 
| 
       79 
     | 
    
         
            -
                    elsif input_field_defn.default_value?
         
     | 
| 
       80 
     | 
    
         
            -
                      coerced_value = input_field_defn.type.coerce_input(input_field_defn.default_value, ctx)
         
     | 
| 
       81 
     | 
    
         
            -
                      input_values[input_key] = coerced_value
         
     | 
| 
       82 
     | 
    
         
            -
                      defaults_used << input_key
         
     | 
| 
       83 
     | 
    
         
            -
                    end
         
     | 
| 
       84 
     | 
    
         
            -
                  end
         
     | 
| 
       85 
     | 
    
         
            -
             
     | 
| 
       86 
     | 
    
         
            -
                  result = arguments_class.new(input_values, context: ctx, defaults_used: defaults_used)
         
     | 
| 
       87 
     | 
    
         
            -
                  result.prepare
         
     | 
| 
       88 
     | 
    
         
            -
                end
         
     | 
| 
       89 
     | 
    
         
            -
             
     | 
| 
       90 
     | 
    
         
            -
                # @api private
         
     | 
| 
       91 
     | 
    
         
            -
                INVALID_OBJECT_MESSAGE = "Expected %{object} to be a key, value object responding to `to_h` or `to_unsafe_h`."
         
     | 
| 
       92 
     | 
    
         
            -
             
     | 
| 
       93 
     | 
    
         
            -
                def validate_non_null_input(input, ctx)
         
     | 
| 
       94 
     | 
    
         
            -
                  warden = ctx.warden
         
     | 
| 
       95 
     | 
    
         
            -
                  result = GraphQL::Query::InputValidationResult.new
         
     | 
| 
       96 
     | 
    
         
            -
             
     | 
| 
       97 
     | 
    
         
            -
                  if input.is_a?(Array)
         
     | 
| 
       98 
     | 
    
         
            -
                    result.add_problem(INVALID_OBJECT_MESSAGE % { object: JSON.generate(input, quirks_mode: true) })
         
     | 
| 
       99 
     | 
    
         
            -
                    return result
         
     | 
| 
       100 
     | 
    
         
            -
                  end
         
     | 
| 
       101 
     | 
    
         
            -
             
     | 
| 
       102 
     | 
    
         
            -
                  # We're not actually _using_ the coerced result, we're just
         
     | 
| 
       103 
     | 
    
         
            -
                  # using these methods to make sure that the object will
         
     | 
| 
       104 
     | 
    
         
            -
                  # behave like a hash below, when we call `each` on it.
         
     | 
| 
       105 
     | 
    
         
            -
                  begin
         
     | 
| 
       106 
     | 
    
         
            -
                    input.to_h
         
     | 
| 
       107 
     | 
    
         
            -
                  rescue
         
     | 
| 
       108 
     | 
    
         
            -
                    begin
         
     | 
| 
       109 
     | 
    
         
            -
                      # Handle ActionController::Parameters:
         
     | 
| 
       110 
     | 
    
         
            -
                      input.to_unsafe_h
         
     | 
| 
       111 
     | 
    
         
            -
                    rescue
         
     | 
| 
       112 
     | 
    
         
            -
                      # We're not sure it'll act like a hash, so reject it:
         
     | 
| 
       113 
     | 
    
         
            -
                      result.add_problem(INVALID_OBJECT_MESSAGE % { object: JSON.generate(input, quirks_mode: true) })
         
     | 
| 
       114 
     | 
    
         
            -
                      return result
         
     | 
| 
       115 
     | 
    
         
            -
                    end
         
     | 
| 
       116 
     | 
    
         
            -
                  end
         
     | 
| 
       117 
     | 
    
         
            -
             
     | 
| 
       118 
     | 
    
         
            -
                  visible_arguments_map = warden.arguments(self).reduce({}) { |m, f| m[f.name] = f; m}
         
     | 
| 
       119 
     | 
    
         
            -
             
     | 
| 
       120 
     | 
    
         
            -
                  # Items in the input that are unexpected
         
     | 
| 
       121 
     | 
    
         
            -
                  input.each do |name, value|
         
     | 
| 
       122 
     | 
    
         
            -
                    if visible_arguments_map[name].nil?
         
     | 
| 
       123 
     | 
    
         
            -
                      result.add_problem("Field is not defined on #{self.graphql_name}", [name])
         
     | 
| 
       124 
     | 
    
         
            -
                    end
         
     | 
| 
       125 
     | 
    
         
            -
                  end
         
     | 
| 
       126 
     | 
    
         
            -
             
     | 
| 
       127 
     | 
    
         
            -
                  # Items in the input that are expected, but have invalid values
         
     | 
| 
       128 
     | 
    
         
            -
                  visible_arguments_map.map do |name, field|
         
     | 
| 
       129 
     | 
    
         
            -
                    field_result = field.type.validate_input(input[name], ctx)
         
     | 
| 
       130 
     | 
    
         
            -
                    if !field_result.valid?
         
     | 
| 
       131 
     | 
    
         
            -
                      result.merge_result!(name, field_result)
         
     | 
| 
       132 
     | 
    
         
            -
                    end
         
     | 
| 
       133 
     | 
    
         
            -
                  end
         
     | 
| 
       134 
     | 
    
         
            -
             
     | 
| 
       135 
     | 
    
         
            -
                  result
         
     | 
| 
       136 
     | 
    
         
            -
                end
         
     | 
| 
       137 
     | 
    
         
            -
              end
         
     | 
| 
       138 
     | 
    
         
            -
            end
         
     | 
    
        data/lib/graphql/int_type.rb
    DELETED
    
    
| 
         @@ -1,72 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # frozen_string_literal: true
         
     | 
| 
       2 
     | 
    
         
            -
            module GraphQL
         
     | 
| 
       3 
     | 
    
         
            -
              # @api deprecated
         
     | 
| 
       4 
     | 
    
         
            -
              class InterfaceType < GraphQL::BaseType
         
     | 
| 
       5 
     | 
    
         
            -
                extend Define::InstanceDefinable::DeprecatedDefine
         
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
                deprecated_accepts_definitions :fields, :orphan_types, :resolve_type, field: GraphQL::Define::AssignObjectField
         
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
                attr_accessor :fields, :orphan_types, :resolve_type_proc
         
     | 
| 
       10 
     | 
    
         
            -
                attr_writer :type_membership_class
         
     | 
| 
       11 
     | 
    
         
            -
                ensure_defined :fields, :orphan_types, :resolve_type_proc, :resolve_type
         
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
                def initialize
         
     | 
| 
       14 
     | 
    
         
            -
                  super
         
     | 
| 
       15 
     | 
    
         
            -
                  @fields = {}
         
     | 
| 
       16 
     | 
    
         
            -
                  @orphan_types = []
         
     | 
| 
       17 
     | 
    
         
            -
                  @resolve_type_proc = nil
         
     | 
| 
       18 
     | 
    
         
            -
                end
         
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
                def initialize_copy(other)
         
     | 
| 
       21 
     | 
    
         
            -
                  super
         
     | 
| 
       22 
     | 
    
         
            -
                  @fields = other.fields.dup
         
     | 
| 
       23 
     | 
    
         
            -
                  @orphan_types = other.orphan_types.dup
         
     | 
| 
       24 
     | 
    
         
            -
                end
         
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
                def kind
         
     | 
| 
       27 
     | 
    
         
            -
                  GraphQL::TypeKinds::INTERFACE
         
     | 
| 
       28 
     | 
    
         
            -
                end
         
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
       30 
     | 
    
         
            -
                def resolve_type(value, ctx)
         
     | 
| 
       31 
     | 
    
         
            -
                  ctx.query.resolve_type(self, value)
         
     | 
| 
       32 
     | 
    
         
            -
                end
         
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
       34 
     | 
    
         
            -
                def resolve_type=(resolve_type_callable)
         
     | 
| 
       35 
     | 
    
         
            -
                  @resolve_type_proc = resolve_type_callable
         
     | 
| 
       36 
     | 
    
         
            -
                end
         
     | 
| 
       37 
     | 
    
         
            -
             
     | 
| 
       38 
     | 
    
         
            -
                # @return [GraphQL::Field] The defined field for `field_name`
         
     | 
| 
       39 
     | 
    
         
            -
                def get_field(field_name)
         
     | 
| 
       40 
     | 
    
         
            -
                  fields[field_name]
         
     | 
| 
       41 
     | 
    
         
            -
                end
         
     | 
| 
       42 
     | 
    
         
            -
             
     | 
| 
       43 
     | 
    
         
            -
                # These fields don't have instrumenation applied
         
     | 
| 
       44 
     | 
    
         
            -
                # @see [Schema#get_fields] Get fields with instrumentation
         
     | 
| 
       45 
     | 
    
         
            -
                # @return [Array<GraphQL::Field>] All fields on this type
         
     | 
| 
       46 
     | 
    
         
            -
                def all_fields
         
     | 
| 
       47 
     | 
    
         
            -
                  fields.values
         
     | 
| 
       48 
     | 
    
         
            -
                end
         
     | 
| 
       49 
     | 
    
         
            -
             
     | 
| 
       50 
     | 
    
         
            -
                # Get a possible type of this {InterfaceType} by type name
         
     | 
| 
       51 
     | 
    
         
            -
                # @param type_name [String]
         
     | 
| 
       52 
     | 
    
         
            -
                # @param ctx [GraphQL::Query::Context] The context for the current query
         
     | 
| 
       53 
     | 
    
         
            -
                # @return [GraphQL::ObjectType, nil] The type named `type_name` if it exists and implements this {InterfaceType}, (else `nil`)
         
     | 
| 
       54 
     | 
    
         
            -
                def get_possible_type(type_name, ctx)
         
     | 
| 
       55 
     | 
    
         
            -
                  type = ctx.query.get_type(type_name)
         
     | 
| 
       56 
     | 
    
         
            -
                  type if type && ctx.query.warden.possible_types(self).include?(type)
         
     | 
| 
       57 
     | 
    
         
            -
                end
         
     | 
| 
       58 
     | 
    
         
            -
             
     | 
| 
       59 
     | 
    
         
            -
                # Check if a type is a possible type of this {InterfaceType}
         
     | 
| 
       60 
     | 
    
         
            -
                # @param type [String, GraphQL::BaseType] Name of the type or a type definition
         
     | 
| 
       61 
     | 
    
         
            -
                # @param ctx [GraphQL::Query::Context] The context for the current query
         
     | 
| 
       62 
     | 
    
         
            -
                # @return [Boolean] True if the `type` exists and is a member of this {InterfaceType}, (else `nil`)
         
     | 
| 
       63 
     | 
    
         
            -
                def possible_type?(type, ctx)
         
     | 
| 
       64 
     | 
    
         
            -
                  type_name = type.is_a?(String) ? type : type.graphql_name
         
     | 
| 
       65 
     | 
    
         
            -
                  !get_possible_type(type_name, ctx).nil?
         
     | 
| 
       66 
     | 
    
         
            -
                end
         
     | 
| 
       67 
     | 
    
         
            -
             
     | 
| 
       68 
     | 
    
         
            -
                def type_membership_class
         
     | 
| 
       69 
     | 
    
         
            -
                  @type_membership_class || GraphQL::Schema::TypeMembership
         
     | 
| 
       70 
     | 
    
         
            -
                end
         
     | 
| 
       71 
     | 
    
         
            -
              end
         
     | 
| 
       72 
     | 
    
         
            -
            end
         
     | 
| 
         @@ -1,27 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # frozen_string_literal: true
         
     | 
| 
       2 
     | 
    
         
            -
            module GraphQL
         
     | 
| 
       3 
     | 
    
         
            -
              module InternalRepresentation
         
     | 
| 
       4 
     | 
    
         
            -
                class Document
         
     | 
| 
       5 
     | 
    
         
            -
                  # @return [Hash<String, Node>] Operation Nodes of this query
         
     | 
| 
       6 
     | 
    
         
            -
                  attr_reader :operation_definitions
         
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
                  # @return [Hash<String, Node>] Fragment definition Nodes of this query
         
     | 
| 
       9 
     | 
    
         
            -
                  attr_reader :fragment_definitions
         
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
                  def initialize
         
     | 
| 
       12 
     | 
    
         
            -
                    @operation_definitions = {}
         
     | 
| 
       13 
     | 
    
         
            -
                    @fragment_definitions = {}
         
     | 
| 
       14 
     | 
    
         
            -
                  end
         
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
                  def [](key)
         
     | 
| 
       17 
     | 
    
         
            -
                    GraphQL::Deprecation.warn "#{self.class}#[] is deprecated; use `operation_definitions[]` instead"
         
     | 
| 
       18 
     | 
    
         
            -
                    operation_definitions[key]
         
     | 
| 
       19 
     | 
    
         
            -
                  end
         
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
                  def each(&block)
         
     | 
| 
       22 
     | 
    
         
            -
                    GraphQL::Deprecation.warn "#{self.class}#each is deprecated; use `operation_definitions.each` instead"
         
     | 
| 
       23 
     | 
    
         
            -
                    operation_definitions.each(&block)
         
     | 
| 
       24 
     | 
    
         
            -
                  end
         
     | 
| 
       25 
     | 
    
         
            -
                end
         
     | 
| 
       26 
     | 
    
         
            -
              end
         
     | 
| 
       27 
     | 
    
         
            -
            end
         
     |