graphql 2.6.11 → 2.6.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rdoc_options +4 -0
- data/lib/generators/graphql/core.rb +1 -0
- data/lib/generators/graphql/detailed_trace_generator.rb +1 -0
- data/lib/generators/graphql/enum_generator.rb +1 -0
- data/lib/generators/graphql/field_extractor.rb +1 -0
- data/lib/generators/graphql/input_generator.rb +1 -0
- data/lib/generators/graphql/install/mutation_root_generator.rb +1 -0
- data/lib/generators/graphql/install_generator.rb +1 -0
- data/lib/generators/graphql/interface_generator.rb +1 -0
- data/lib/generators/graphql/loader_generator.rb +8 -2
- data/lib/generators/graphql/mutation_create_generator.rb +8 -2
- data/lib/generators/graphql/mutation_delete_generator.rb +8 -2
- data/lib/generators/graphql/mutation_generator.rb +8 -2
- data/lib/generators/graphql/mutation_update_generator.rb +8 -2
- data/lib/generators/graphql/object_generator.rb +1 -0
- data/lib/generators/graphql/orm_mutations_base.rb +8 -2
- data/lib/generators/graphql/relay.rb +1 -0
- data/lib/generators/graphql/relay_generator.rb +1 -0
- data/lib/generators/graphql/scalar_generator.rb +1 -0
- data/lib/generators/graphql/type_generator.rb +38 -8
- data/lib/generators/graphql/union_generator.rb +1 -0
- data/lib/graphql/analysis/analyzer.rb +35 -9
- data/lib/graphql/analysis/field_usage.rb +1 -0
- data/lib/graphql/analysis/max_query_complexity.rb +2 -1
- data/lib/graphql/analysis/max_query_depth.rb +1 -0
- data/lib/graphql/analysis/query_complexity.rb +57 -20
- data/lib/graphql/analysis/query_depth.rb +17 -12
- data/lib/graphql/analysis/visitor.rb +79 -16
- data/lib/graphql/analysis.rb +23 -6
- data/lib/graphql/analysis_error.rb +1 -0
- data/lib/graphql/autoload.rb +30 -7
- data/lib/graphql/backtrace/table.rb +21 -5
- data/lib/graphql/backtrace/traced_error.rb +8 -3
- data/lib/graphql/backtrace.rb +14 -9
- data/lib/graphql/coercion_error.rb +1 -0
- data/lib/graphql/current.rb +44 -19
- data/lib/graphql/dashboard/application_controller.rb +1 -0
- data/lib/graphql/dashboard/detailed_traces.rb +1 -0
- data/lib/graphql/dashboard/installable.rb +1 -0
- data/lib/graphql/dashboard/landings_controller.rb +1 -0
- data/lib/graphql/dashboard/limiters.rb +1 -0
- data/lib/graphql/dashboard/operation_store.rb +1 -0
- data/lib/graphql/dashboard/statics_controller.rb +1 -0
- data/lib/graphql/dashboard/subscriptions.rb +1 -0
- data/lib/graphql/dashboard.rb +36 -22
- data/lib/graphql/dataloader/active_record_association_source.rb +1 -0
- data/lib/graphql/dataloader/active_record_source.rb +1 -0
- data/lib/graphql/dataloader/async_dataloader.rb +10 -7
- data/lib/graphql/dataloader/null_dataloader.rb +4 -3
- data/lib/graphql/dataloader/request.rb +8 -2
- data/lib/graphql/dataloader/request_all.rb +8 -2
- data/lib/graphql/dataloader/source.rb +127 -35
- data/lib/graphql/dataloader.rb +93 -42
- data/lib/graphql/date_encoding_error.rb +2 -1
- data/lib/graphql/dig.rb +12 -3
- data/lib/graphql/duration_encoding_error.rb +2 -1
- data/lib/graphql/execution/directive_checks.rb +8 -3
- data/lib/graphql/execution/errors.rb +20 -6
- data/lib/graphql/execution/field_resolve_step.rb +40 -13
- data/lib/graphql/execution/finalize.rb +12 -6
- data/lib/graphql/execution/input_values.rb +2 -1
- data/lib/graphql/execution/interpreter/argument_value.rb +17 -5
- data/lib/graphql/execution/interpreter/arguments.rb +24 -9
- data/lib/graphql/execution/interpreter/arguments_cache.rb +2 -1
- data/lib/graphql/execution/interpreter/execution_errors.rb +1 -0
- data/lib/graphql/execution/interpreter/handles_raw_value.rb +1 -0
- data/lib/graphql/execution/interpreter/resolve.rb +18 -8
- data/lib/graphql/execution/interpreter/runtime/graphql_result.rb +4 -1
- data/lib/graphql/execution/interpreter/runtime.rb +72 -25
- data/lib/graphql/execution/interpreter.rb +15 -6
- data/lib/graphql/execution/lazy/lazy_method_map.rb +21 -8
- data/lib/graphql/execution/lazy.rb +34 -10
- data/lib/graphql/execution/load_argument_step.rb +1 -0
- data/lib/graphql/execution/lookahead.rb +137 -54
- data/lib/graphql/execution/multiplex.rb +4 -4
- data/lib/graphql/execution/next.rb +7 -0
- data/lib/graphql/execution/prepare_object_step.rb +1 -0
- data/lib/graphql/execution/resolve_type_step.rb +2 -1
- data/lib/graphql/execution/runner.rb +9 -3
- data/lib/graphql/execution/selections_step.rb +3 -2
- data/lib/graphql/execution.rb +2 -2
- data/lib/graphql/execution_error.rb +19 -10
- data/lib/graphql/float_decoding_error.rb +1 -0
- data/lib/graphql/float_encoding_error.rb +7 -2
- data/lib/graphql/integer_decoding_error.rb +2 -1
- data/lib/graphql/integer_encoding_error.rb +8 -3
- data/lib/graphql/introspection/base_object.rb +3 -1
- data/lib/graphql/introspection/directive_location_enum.rb +1 -0
- data/lib/graphql/introspection/directive_type.rb +1 -0
- data/lib/graphql/introspection/dynamic_fields.rb +1 -0
- data/lib/graphql/introspection/entry_points.rb +1 -0
- data/lib/graphql/introspection/enum_value_type.rb +1 -0
- data/lib/graphql/introspection/field_type.rb +1 -0
- data/lib/graphql/introspection/input_value_type.rb +1 -0
- data/lib/graphql/introspection/introspection_query.rb +1 -0
- data/lib/graphql/introspection/schema_type.rb +1 -0
- data/lib/graphql/introspection/type_kind_enum.rb +1 -0
- data/lib/graphql/introspection/type_type.rb +1 -0
- data/lib/graphql/introspection.rb +1 -0
- data/lib/graphql/invalid_name_error.rb +1 -0
- data/lib/graphql/invalid_null_error.rb +19 -6
- data/lib/graphql/language/block_string.rb +2 -1
- data/lib/graphql/language/cache.rb +10 -4
- data/lib/graphql/language/comment.rb +1 -0
- data/lib/graphql/language/definition_slice.rb +1 -0
- data/lib/graphql/language/document_from_schema_definition.rb +9 -10
- data/lib/graphql/language/generation.rb +23 -9
- data/lib/graphql/language/lexer.rb +5 -0
- data/lib/graphql/language/nodes.rb +2094 -419
- data/lib/graphql/language/parser.rb +24 -17
- data/lib/graphql/language/printer.rb +31 -16
- data/lib/graphql/language/sanitized_printer.rb +16 -5
- data/lib/graphql/language/static_visitor.rb +19 -4
- data/lib/graphql/language/visitor.rb +51 -29
- data/lib/graphql/language.rb +13 -7
- data/lib/graphql/load_application_object_failed_error.rb +14 -5
- data/lib/graphql/name_validator.rb +1 -0
- data/lib/graphql/pagination/active_record_relation_connection.rb +1 -0
- data/lib/graphql/pagination/array_connection.rb +20 -6
- data/lib/graphql/pagination/connection.rb +178 -48
- data/lib/graphql/pagination/connections.rb +21 -14
- data/lib/graphql/pagination/mongoid_relation_connection.rb +1 -0
- data/lib/graphql/pagination/relation_connection.rb +123 -22
- data/lib/graphql/pagination/sequel_dataset_connection.rb +1 -0
- data/lib/graphql/pagination.rb +1 -0
- data/lib/graphql/parse_error.rb +1 -0
- data/lib/graphql/query/context/scoped_context.rb +2 -1
- data/lib/graphql/query/context.rb +106 -35
- data/lib/graphql/query/fingerprint.rb +15 -7
- data/lib/graphql/query/input_validation_result.rb +1 -0
- data/lib/graphql/query/null_context.rb +1 -0
- data/lib/graphql/query/partial.rb +28 -15
- data/lib/graphql/query/result.rb +15 -5
- data/lib/graphql/query/validation_pipeline.rb +16 -6
- data/lib/graphql/query/variable_validation_error.rb +1 -0
- data/lib/graphql/query/variables.rb +9 -2
- data/lib/graphql/query.rb +193 -49
- data/lib/graphql/railtie.rb +7 -3
- data/lib/graphql/rake_task/validate.rb +72 -17
- data/lib/graphql/rake_task.rb +55 -23
- data/lib/graphql/relay/range_add.rb +32 -21
- data/lib/graphql/relay.rb +1 -0
- data/lib/graphql/rubocop/graphql/base_cop.rb +1 -0
- data/lib/graphql/rubocop/graphql/default_null_true.rb +9 -6
- data/lib/graphql/rubocop/graphql/default_required_true.rb +9 -6
- data/lib/graphql/rubocop/graphql/field_type_in_block.rb +12 -8
- data/lib/graphql/rubocop/graphql/root_types_in_block.rb +9 -5
- data/lib/graphql/rubocop.rb +1 -0
- data/lib/graphql/runtime_error.rb +1 -0
- data/lib/graphql/runtime_type_error.rb +1 -0
- data/lib/graphql/schema/addition.rb +18 -6
- data/lib/graphql/schema/always_visible.rb +1 -0
- data/lib/graphql/schema/argument.rb +265 -42
- data/lib/graphql/schema/base_64_encoder.rb +2 -2
- data/lib/graphql/schema/build_from_definition/resolve_map/default_resolve.rb +1 -0
- data/lib/graphql/schema/build_from_definition/resolve_map.rb +2 -2
- data/lib/graphql/schema/build_from_definition.rb +94 -27
- data/lib/graphql/schema/built_in_types.rb +1 -0
- data/lib/graphql/schema/directive/deprecated.rb +1 -0
- data/lib/graphql/schema/directive/feature.rb +39 -22
- data/lib/graphql/schema/directive/flagged.rb +6 -1
- data/lib/graphql/schema/directive/include.rb +1 -0
- data/lib/graphql/schema/directive/one_of.rb +1 -0
- data/lib/graphql/schema/directive/skip.rb +1 -0
- data/lib/graphql/schema/directive/specified_by.rb +1 -0
- data/lib/graphql/schema/directive/transform.rb +17 -8
- data/lib/graphql/schema/directive.rb +12 -7
- data/lib/graphql/schema/enum.rb +99 -38
- data/lib/graphql/schema/enum_value.rb +21 -13
- data/lib/graphql/schema/field/connection_extension.rb +10 -2
- data/lib/graphql/schema/field/scope_extension.rb +1 -0
- data/lib/graphql/schema/field.rb +621 -109
- data/lib/graphql/schema/field_extension.rb +89 -34
- data/lib/graphql/schema/find_inherited_value.rb +5 -3
- data/lib/graphql/schema/finder.rb +22 -8
- data/lib/graphql/schema/has_single_input_argument.rb +39 -6
- data/lib/graphql/schema/input_object.rb +40 -13
- data/lib/graphql/schema/interface.rb +33 -17
- data/lib/graphql/schema/introspection_system.rb +7 -3
- data/lib/graphql/schema/late_bound_type.rb +2 -2
- data/lib/graphql/schema/list.rb +15 -4
- data/lib/graphql/schema/loader.rb +23 -12
- data/lib/graphql/schema/member/base_dsl_methods.rb +58 -12
- data/lib/graphql/schema/member/build_type.rb +16 -5
- data/lib/graphql/schema/member/graphql_type_names.rb +10 -6
- data/lib/graphql/schema/member/has_arguments.rb +115 -48
- data/lib/graphql/schema/member/has_ast_node.rb +1 -0
- data/lib/graphql/schema/member/has_authorization.rb +5 -0
- data/lib/graphql/schema/member/has_dataloader.rb +91 -34
- data/lib/graphql/schema/member/has_deprecation_reason.rb +15 -2
- data/lib/graphql/schema/member/has_directives.rb +38 -10
- data/lib/graphql/schema/member/has_fields.rb +151 -70
- data/lib/graphql/schema/member/has_interfaces.rb +10 -2
- data/lib/graphql/schema/member/has_path.rb +14 -5
- data/lib/graphql/schema/member/has_unresolved_type_error.rb +1 -0
- data/lib/graphql/schema/member/has_validators.rb +19 -4
- data/lib/graphql/schema/member/relay_shortcuts.rb +10 -2
- data/lib/graphql/schema/member/scoped.rb +14 -3
- data/lib/graphql/schema/member/type_system_helpers.rb +36 -6
- data/lib/graphql/schema/member/validates_input.rb +1 -0
- data/lib/graphql/schema/member.rb +9 -2
- data/lib/graphql/schema/mutation.rb +50 -46
- data/lib/graphql/schema/non_null.rb +21 -5
- data/lib/graphql/schema/object.rb +33 -12
- data/lib/graphql/schema/printer.rb +52 -31
- data/lib/graphql/schema/ractor_shareable.rb +6 -2
- data/lib/graphql/schema/relay_classic_mutation.rb +3 -3
- data/lib/graphql/schema/resolver/has_payload_type.rb +29 -7
- data/lib/graphql/schema/resolver.rb +156 -45
- data/lib/graphql/schema/scalar.rb +1 -0
- data/lib/graphql/schema/subscription.rb +67 -28
- data/lib/graphql/schema/timeout.rb +65 -25
- data/lib/graphql/schema/type_expression.rb +14 -5
- data/lib/graphql/schema/type_membership.rb +29 -10
- data/lib/graphql/schema/union.rb +4 -2
- data/lib/graphql/schema/unique_within_type.rb +24 -5
- data/lib/graphql/schema/validator/all_validator.rb +17 -9
- data/lib/graphql/schema/validator/allow_blank_validator.rb +8 -2
- data/lib/graphql/schema/validator/allow_null_validator.rb +8 -2
- data/lib/graphql/schema/validator/exclusion_validator.rb +14 -5
- data/lib/graphql/schema/validator/format_validator.rb +21 -10
- data/lib/graphql/schema/validator/inclusion_validator.rb +15 -6
- data/lib/graphql/schema/validator/length_validator.rb +23 -12
- data/lib/graphql/schema/validator/numericality_validator.rb +29 -16
- data/lib/graphql/schema/validator/required_validator.rb +45 -31
- data/lib/graphql/schema/validator.rb +89 -25
- data/lib/graphql/schema/visibility/migration.rb +14 -7
- data/lib/graphql/schema/visibility/profile.rb +65 -20
- data/lib/graphql/schema/visibility/visit.rb +12 -10
- data/lib/graphql/schema/visibility.rb +24 -20
- data/lib/graphql/schema/warden.rb +117 -31
- data/lib/graphql/schema/wrapper.rb +4 -1
- data/lib/graphql/schema.rb +1046 -300
- data/lib/graphql/static_validation/all_rules.rb +2 -1
- data/lib/graphql/static_validation/base_visitor.rb +59 -9
- data/lib/graphql/static_validation/definition_dependencies.rb +27 -7
- data/lib/graphql/static_validation/error.rb +3 -0
- data/lib/graphql/static_validation/interpreter_visitor.rb +1 -0
- data/lib/graphql/static_validation/literal_validator.rb +1 -0
- data/lib/graphql/static_validation/rules/argument_literals_are_compatible.rb +4 -0
- data/lib/graphql/static_validation/rules/argument_literals_are_compatible_error.rb +1 -0
- data/lib/graphql/static_validation/rules/argument_names_are_unique.rb +3 -0
- data/lib/graphql/static_validation/rules/argument_names_are_unique_error.rb +1 -0
- data/lib/graphql/static_validation/rules/arguments_are_defined.rb +3 -0
- data/lib/graphql/static_validation/rules/arguments_are_defined_error.rb +1 -0
- data/lib/graphql/static_validation/rules/directives_are_defined.rb +3 -0
- data/lib/graphql/static_validation/rules/directives_are_defined_error.rb +1 -0
- data/lib/graphql/static_validation/rules/directives_are_in_valid_locations.rb +3 -0
- data/lib/graphql/static_validation/rules/directives_are_in_valid_locations_error.rb +1 -0
- data/lib/graphql/static_validation/rules/fields_are_defined_on_type.rb +3 -0
- data/lib/graphql/static_validation/rules/fields_are_defined_on_type_error.rb +1 -0
- data/lib/graphql/static_validation/rules/fields_have_appropriate_selections.rb +9 -1
- data/lib/graphql/static_validation/rules/fields_have_appropriate_selections_error.rb +1 -0
- data/lib/graphql/static_validation/rules/fields_will_merge.rb +295 -134
- data/lib/graphql/static_validation/rules/fields_will_merge_error.rb +14 -2
- data/lib/graphql/static_validation/rules/fragment_names_are_unique.rb +3 -0
- data/lib/graphql/static_validation/rules/fragment_names_are_unique_error.rb +1 -0
- data/lib/graphql/static_validation/rules/fragment_spreads_are_possible.rb +3 -0
- data/lib/graphql/static_validation/rules/fragment_spreads_are_possible_error.rb +1 -0
- data/lib/graphql/static_validation/rules/fragment_types_exist.rb +3 -0
- data/lib/graphql/static_validation/rules/fragment_types_exist_error.rb +1 -0
- data/lib/graphql/static_validation/rules/fragments_are_finite.rb +3 -0
- data/lib/graphql/static_validation/rules/fragments_are_finite_error.rb +1 -0
- data/lib/graphql/static_validation/rules/fragments_are_named.rb +3 -0
- data/lib/graphql/static_validation/rules/fragments_are_named_error.rb +1 -0
- data/lib/graphql/static_validation/rules/fragments_are_on_composite_types.rb +3 -0
- data/lib/graphql/static_validation/rules/fragments_are_on_composite_types_error.rb +1 -0
- data/lib/graphql/static_validation/rules/fragments_are_used.rb +3 -0
- data/lib/graphql/static_validation/rules/fragments_are_used_error.rb +1 -0
- data/lib/graphql/static_validation/rules/input_object_names_are_unique.rb +3 -0
- data/lib/graphql/static_validation/rules/input_object_names_are_unique_error.rb +1 -0
- data/lib/graphql/static_validation/rules/mutation_root_exists.rb +3 -0
- data/lib/graphql/static_validation/rules/mutation_root_exists_error.rb +1 -0
- data/lib/graphql/static_validation/rules/no_definitions_are_present.rb +3 -0
- data/lib/graphql/static_validation/rules/no_definitions_are_present_error.rb +1 -0
- data/lib/graphql/static_validation/rules/not_single_subscription_error.rb +1 -0
- data/lib/graphql/static_validation/rules/one_of_input_objects_are_valid.rb +4 -0
- data/lib/graphql/static_validation/rules/one_of_input_objects_are_valid_error.rb +1 -0
- data/lib/graphql/static_validation/rules/operation_names_are_valid.rb +3 -0
- data/lib/graphql/static_validation/rules/operation_names_are_valid_error.rb +1 -0
- data/lib/graphql/static_validation/rules/query_root_exists.rb +3 -0
- data/lib/graphql/static_validation/rules/query_root_exists_error.rb +1 -0
- data/lib/graphql/static_validation/rules/required_arguments_are_present.rb +4 -1
- data/lib/graphql/static_validation/rules/required_arguments_are_present_error.rb +1 -0
- data/lib/graphql/static_validation/rules/required_input_object_attributes_are_present.rb +4 -0
- data/lib/graphql/static_validation/rules/required_input_object_attributes_are_present_error.rb +1 -0
- data/lib/graphql/static_validation/rules/subscription_root_exists_and_single_subscription_selection.rb +43 -5
- data/lib/graphql/static_validation/rules/subscription_root_exists_error.rb +1 -0
- data/lib/graphql/static_validation/rules/unique_directives_per_location.rb +3 -0
- data/lib/graphql/static_validation/rules/unique_directives_per_location_error.rb +1 -0
- data/lib/graphql/static_validation/rules/variable_default_values_are_correctly_typed.rb +3 -0
- data/lib/graphql/static_validation/rules/variable_default_values_are_correctly_typed_error.rb +1 -0
- data/lib/graphql/static_validation/rules/variable_names_are_unique.rb +3 -0
- data/lib/graphql/static_validation/rules/variable_names_are_unique_error.rb +1 -0
- data/lib/graphql/static_validation/rules/variable_usages_are_allowed.rb +207 -51
- data/lib/graphql/static_validation/rules/variable_usages_are_allowed_error.rb +1 -0
- data/lib/graphql/static_validation/rules/variables_are_input_types.rb +3 -0
- data/lib/graphql/static_validation/rules/variables_are_input_types_error.rb +1 -0
- data/lib/graphql/static_validation/rules/variables_are_used_and_defined.rb +6 -3
- data/lib/graphql/static_validation/rules/variables_are_used_and_defined_error.rb +1 -0
- data/lib/graphql/static_validation/validation_context.rb +3 -2
- data/lib/graphql/static_validation/validation_timeout_error.rb +1 -0
- data/lib/graphql/static_validation/validator.rb +41 -16
- data/lib/graphql/static_validation.rb +1 -0
- data/lib/graphql/string_encoding_error.rb +1 -0
- data/lib/graphql/subscriptions/action_cable_subscriptions.rb +85 -65
- data/lib/graphql/subscriptions/broadcast_analyzer.rb +10 -4
- data/lib/graphql/subscriptions/default_subscription_resolve_extension.rb +1 -0
- data/lib/graphql/subscriptions/event.rb +25 -6
- data/lib/graphql/subscriptions/serialize.rb +58 -19
- data/lib/graphql/subscriptions.rb +172 -46
- data/lib/graphql/testing/helpers.rb +17 -4
- data/lib/graphql/testing/mock_action_cable.rb +55 -33
- data/lib/graphql/testing.rb +1 -0
- data/lib/graphql/tracing/active_support_notifications_trace.rb +17 -9
- data/lib/graphql/tracing/active_support_notifications_tracing.rb +2 -1
- data/lib/graphql/tracing/appoptics_trace.rb +2 -1
- data/lib/graphql/tracing/appoptics_tracing.rb +2 -1
- data/lib/graphql/tracing/appsignal_trace.rb +16 -7
- data/lib/graphql/tracing/appsignal_tracing.rb +7 -3
- data/lib/graphql/tracing/call_legacy_tracers.rb +1 -0
- data/lib/graphql/tracing/data_dog_trace.rb +17 -6
- data/lib/graphql/tracing/data_dog_tracing.rb +10 -3
- data/lib/graphql/tracing/detailed_trace/active_record_backend.rb +1 -0
- data/lib/graphql/tracing/detailed_trace/memory_backend.rb +1 -0
- data/lib/graphql/tracing/detailed_trace/redis_backend.rb +1 -0
- data/lib/graphql/tracing/detailed_trace.rb +105 -42
- data/lib/graphql/tracing/legacy_hooks_trace.rb +5 -0
- data/lib/graphql/tracing/legacy_trace.rb +1 -0
- data/lib/graphql/tracing/monitor_trace.rb +17 -11
- data/lib/graphql/tracing/new_relic_trace.rb +17 -8
- data/lib/graphql/tracing/new_relic_tracing.rb +7 -3
- data/lib/graphql/tracing/notifications_trace.rb +11 -8
- data/lib/graphql/tracing/notifications_tracing.rb +23 -7
- data/lib/graphql/tracing/null_trace.rb +1 -0
- data/lib/graphql/tracing/perfetto_trace/trace_pb.rb +1 -0
- data/lib/graphql/tracing/perfetto_trace.rb +41 -19
- data/lib/graphql/tracing/platform_trace.rb +3 -1
- data/lib/graphql/tracing/platform_tracing.rb +16 -7
- data/lib/graphql/tracing/prometheus_trace/graphql_collector.rb +1 -0
- data/lib/graphql/tracing/prometheus_trace.rb +22 -13
- data/lib/graphql/tracing/prometheus_tracing.rb +1 -0
- data/lib/graphql/tracing/scout_trace.rb +10 -4
- data/lib/graphql/tracing/scout_tracing.rb +7 -3
- data/lib/graphql/tracing/sentry_trace.rb +12 -5
- data/lib/graphql/tracing/statsd_trace.rb +12 -6
- data/lib/graphql/tracing/statsd_tracing.rb +7 -1
- data/lib/graphql/tracing/trace.rb +231 -58
- data/lib/graphql/tracing.rb +25 -9
- data/lib/graphql/type_kinds.rb +2 -1
- data/lib/graphql/types/big_int.rb +1 -0
- data/lib/graphql/types/boolean.rb +1 -0
- data/lib/graphql/types/float.rb +1 -0
- data/lib/graphql/types/id.rb +1 -0
- data/lib/graphql/types/int.rb +2 -1
- data/lib/graphql/types/iso_8601_date.rb +21 -4
- data/lib/graphql/types/iso_8601_date_time.rb +33 -6
- data/lib/graphql/types/iso_8601_duration.rb +42 -9
- data/lib/graphql/types/json.rb +1 -0
- data/lib/graphql/types/relay/base_connection.rb +38 -32
- data/lib/graphql/types/relay/base_edge.rb +15 -9
- data/lib/graphql/types/relay/connection_behaviors.rb +19 -3
- data/lib/graphql/types/relay/edge_behaviors.rb +17 -4
- data/lib/graphql/types/relay/has_node_field.rb +6 -1
- data/lib/graphql/types/relay/has_nodes_field.rb +6 -1
- data/lib/graphql/types/relay/node.rb +1 -0
- data/lib/graphql/types/relay/node_behaviors.rb +5 -1
- data/lib/graphql/types/relay/page_info.rb +1 -0
- data/lib/graphql/types/relay/page_info_behaviors.rb +1 -0
- data/lib/graphql/types/relay.rb +4 -3
- data/lib/graphql/types/string.rb +1 -0
- data/lib/graphql/types.rb +1 -0
- data/lib/graphql/unauthorized_enum_value_error.rb +4 -1
- data/lib/graphql/unauthorized_error.rb +11 -4
- data/lib/graphql/unauthorized_field_error.rb +4 -1
- data/lib/graphql/unresolved_type_error.rb +16 -5
- data/lib/graphql/version.rb +2 -1
- data/lib/graphql.rb +37 -9
- data/readme.md +1 -1
- metadata +89 -5
- data/.yardopts +0 -5
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
+
# typed: true
|
|
2
3
|
require "graphql/schema/visibility/profile"
|
|
3
4
|
require "graphql/schema/visibility/migration"
|
|
4
5
|
require "graphql/schema/visibility/visit"
|
|
@@ -14,10 +15,15 @@ module GraphQL
|
|
|
14
15
|
super(message)
|
|
15
16
|
end
|
|
16
17
|
end
|
|
17
|
-
#
|
|
18
|
-
#
|
|
19
|
-
#
|
|
20
|
-
#
|
|
18
|
+
# **Parameters**
|
|
19
|
+
#
|
|
20
|
+
# - `schema` (`Class<GraphQL::Schema>`)
|
|
21
|
+
# - `profiles` (`Hash<Symbol => Hash>`) — A hash of `name => context` pairs for preloading visibility profiles
|
|
22
|
+
# - `preload` (`Boolean`) — if `true`, load the default schema profile and all named profiles immediately (defaults to `true` for `Rails.env.production?` and `Rails.env.staging?`)
|
|
23
|
+
# - `migration_errors` (`Boolean`) — if `true`, raise an error when `Visibility` and `Warden` return different results
|
|
24
|
+
#
|
|
25
|
+
# :call-seq:
|
|
26
|
+
# use(Class[GraphQL::Schema] schema, dynamic:, Hash[Symbol, Hash] profiles:, bool preload:)
|
|
21
27
|
def self.use(schema, dynamic: false, profiles: EmptyObjects::EMPTY_HASH, preload: (defined?(Rails.env) ? (Rails.env.production? || Rails.env.staging? || nil) : false), migration_errors: false)
|
|
22
28
|
profiles&.each { |name, ctx|
|
|
23
29
|
ctx[:visibility_profile] = name
|
|
@@ -108,35 +114,32 @@ module GraphQL
|
|
|
108
114
|
end
|
|
109
115
|
end
|
|
110
116
|
|
|
111
|
-
#
|
|
112
|
-
def query_configured(query_type)
|
|
117
|
+
def query_configured(query_type) # :nodoc:
|
|
113
118
|
require_if_preloaded("a query type was", "query(...)")
|
|
114
119
|
end
|
|
115
120
|
|
|
116
|
-
#
|
|
117
|
-
def mutation_configured(mutation_type)
|
|
121
|
+
def mutation_configured(mutation_type) # :nodoc:
|
|
118
122
|
require_if_preloaded("a mutation type was", "mutation(...)")
|
|
119
123
|
end
|
|
120
124
|
|
|
121
|
-
#
|
|
122
|
-
def subscription_configured(subscription_type)
|
|
125
|
+
def subscription_configured(subscription_type) # :nodoc:
|
|
123
126
|
require_if_preloaded("a mutation type was", "subscription(...)")
|
|
124
127
|
end
|
|
125
128
|
|
|
126
|
-
#
|
|
127
|
-
def orphan_types_configured(orphan_types)
|
|
129
|
+
def orphan_types_configured(orphan_types) # :nodoc:
|
|
128
130
|
require_if_preloaded("orphan types were", "orphan_types(...)")
|
|
129
131
|
end
|
|
130
132
|
|
|
131
|
-
#
|
|
132
|
-
def introspection_system_configured(introspection_system)
|
|
133
|
+
def introspection_system_configured(introspection_system) # :nodoc:
|
|
133
134
|
require_if_preloaded("custom introspection was", "introspection(...)")
|
|
134
135
|
end
|
|
135
136
|
|
|
136
137
|
# Make another Visibility for `schema` based on this one
|
|
137
|
-
#
|
|
138
|
-
#
|
|
139
|
-
|
|
138
|
+
#
|
|
139
|
+
# **Returns**
|
|
140
|
+
#
|
|
141
|
+
# - `Visibility`
|
|
142
|
+
def dup_for(other_schema) # :nodoc:
|
|
140
143
|
self.class.new(
|
|
141
144
|
other_schema,
|
|
142
145
|
dynamic: @dynamic,
|
|
@@ -179,8 +182,7 @@ module GraphQL
|
|
|
179
182
|
|
|
180
183
|
attr_reader :top_level
|
|
181
184
|
|
|
182
|
-
#
|
|
183
|
-
attr_reader :unfiltered_interface_type_memberships
|
|
185
|
+
attr_reader :unfiltered_interface_type_memberships # :nodoc:
|
|
184
186
|
|
|
185
187
|
def top_level_profile(refresh: false)
|
|
186
188
|
if refresh
|
|
@@ -231,6 +233,7 @@ module GraphQL
|
|
|
231
233
|
@unions_for_references = Set.new
|
|
232
234
|
@visit = Visibility::Visit.new(@schema) do |member|
|
|
233
235
|
if member.is_a?(Module)
|
|
236
|
+
member = member #: as GraphQL::Schema::Member::type_definition
|
|
234
237
|
type_name = member.graphql_name
|
|
235
238
|
if (prev_t = @types[type_name])
|
|
236
239
|
if prev_t.is_a?(Array)
|
|
@@ -245,7 +248,8 @@ module GraphQL
|
|
|
245
248
|
if member < GraphQL::Schema::Directive
|
|
246
249
|
@directives << member
|
|
247
250
|
elsif member.respond_to?(:interface_type_memberships)
|
|
248
|
-
member
|
|
251
|
+
implementing_type = member #: as GraphQL::Schema::Member::HasInterfaces
|
|
252
|
+
implementing_type.interface_type_memberships.each do |itm|
|
|
249
253
|
@all_references[itm.abstract_type] << member
|
|
250
254
|
# `itm.object_type` may not actually be `member` if this implementation
|
|
251
255
|
# is inherited from a superclass
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
+
# typed: true
|
|
2
3
|
|
|
3
4
|
require 'set'
|
|
4
5
|
|
|
5
6
|
module GraphQL
|
|
6
7
|
class Schema
|
|
7
|
-
# Restrict access to a
|
|
8
|
+
# Restrict access to a [GraphQL::Schema](rdoc-ref:GraphQL::Schema) with a user-defined `visible?` implementations.
|
|
8
9
|
#
|
|
9
10
|
# When validating and executing a query, all access to schema members
|
|
10
11
|
# should go through a warden. If you access the schema directly,
|
|
11
12
|
# you may show a client something that it shouldn't be allowed to see.
|
|
12
13
|
#
|
|
13
|
-
#
|
|
14
|
-
class Warden
|
|
14
|
+
class Warden # :nodoc:
|
|
15
15
|
def self.from_context(context)
|
|
16
16
|
context.warden || PassThruWarden
|
|
17
17
|
rescue NoMethodError
|
|
@@ -30,15 +30,23 @@ module GraphQL
|
|
|
30
30
|
# no-op
|
|
31
31
|
end
|
|
32
32
|
|
|
33
|
-
#
|
|
34
|
-
#
|
|
35
|
-
#
|
|
36
|
-
#
|
|
37
|
-
#
|
|
38
|
-
#
|
|
33
|
+
# **Parameters**
|
|
34
|
+
#
|
|
35
|
+
# - `visibility_method` (`Symbol`) — a Warden method to call for this entry
|
|
36
|
+
# - `entry` (`Object, Array<Object>`) — One or more definitions for a given name in a GraphQL Schema
|
|
37
|
+
# - `context` (`GraphQL::Query::Context`)
|
|
38
|
+
# - `warden` (`Warden`)
|
|
39
|
+
#
|
|
40
|
+
# **Returns**
|
|
41
|
+
#
|
|
42
|
+
# - `Object` — `entry` or one of `entry`'s items if exactly one of them is visible for this context
|
|
43
|
+
# - `nil` — If neither `entry` nor any of `entry`'s items are visible for this context
|
|
44
|
+
#
|
|
45
|
+
# :call-seq:
|
|
46
|
+
# visible_entry?(Symbol visibility_method, Object | Array[Object] entry, GraphQL::Query::Context context, Warden warden) -> Object | nil
|
|
39
47
|
def self.visible_entry?(visibility_method, entry, context, warden = Warden.from_context(context))
|
|
40
48
|
if entry.is_a?(Array)
|
|
41
|
-
visible_item = nil
|
|
49
|
+
visible_item = nil #: untyped
|
|
42
50
|
entry.each do |item|
|
|
43
51
|
if warden.public_send(visibility_method, item, context)
|
|
44
52
|
if visible_item.nil?
|
|
@@ -107,7 +115,7 @@ module GraphQL
|
|
|
107
115
|
def get_field(parent_type, field_name); @schema.get_field(parent_type, field_name); end
|
|
108
116
|
def reachable_type?(type_name); true; end
|
|
109
117
|
def loadable?(type, _ctx); true; end
|
|
110
|
-
def loadable_possible_types(abstract_type, _ctx);
|
|
118
|
+
def loadable_possible_types(abstract_type, _ctx); possible_types(abstract_type); end
|
|
111
119
|
def reachable_types; @schema.types.values; end # rubocop:disable Development/ContextIsPassedCop
|
|
112
120
|
def possible_types(type_defn); @schema.possible_types(type_defn, Query::NullContext.instance, false); end
|
|
113
121
|
def interfaces(obj_type); obj_type.interfaces; end
|
|
@@ -195,8 +203,13 @@ module GraphQL
|
|
|
195
203
|
end
|
|
196
204
|
end
|
|
197
205
|
|
|
198
|
-
#
|
|
199
|
-
#
|
|
206
|
+
# **Parameters**
|
|
207
|
+
#
|
|
208
|
+
# - `context` (`GraphQL::Query::Context`)
|
|
209
|
+
# - `schema` (`GraphQL::Schema`)
|
|
210
|
+
#
|
|
211
|
+
# :call-seq:
|
|
212
|
+
# initialize(GraphQL::Query::Context context:, GraphQL::Schema schema:)
|
|
200
213
|
def initialize(context:, schema:)
|
|
201
214
|
@schema = schema
|
|
202
215
|
# Cache these to avoid repeated hits to the inheritance chain when one isn't present
|
|
@@ -217,7 +230,12 @@ module GraphQL
|
|
|
217
230
|
|
|
218
231
|
attr_writer :skip_warning
|
|
219
232
|
|
|
220
|
-
#
|
|
233
|
+
# **Returns**
|
|
234
|
+
#
|
|
235
|
+
# - `Hash<String, GraphQL::BaseType>` — Visible types in the schema
|
|
236
|
+
#
|
|
237
|
+
# :call-seq:
|
|
238
|
+
# types() -> Hash[String, GraphQL::BaseType]
|
|
221
239
|
def types
|
|
222
240
|
@types ||= begin
|
|
223
241
|
vis_types = {}
|
|
@@ -230,7 +248,12 @@ module GraphQL
|
|
|
230
248
|
end
|
|
231
249
|
end
|
|
232
250
|
|
|
233
|
-
#
|
|
251
|
+
# **Returns**
|
|
252
|
+
#
|
|
253
|
+
# - `Boolean` — True if this type is used for `loads:` but not in the schema otherwise and not _explicitly_ hidden.
|
|
254
|
+
#
|
|
255
|
+
# :call-seq:
|
|
256
|
+
# loadable?(type, _ctx) -> bool
|
|
234
257
|
def loadable?(type, _ctx)
|
|
235
258
|
visible_type?(type) &&
|
|
236
259
|
!referenced?(type) &&
|
|
@@ -242,15 +265,21 @@ module GraphQL
|
|
|
242
265
|
def loadable_possible_types(abstract_type, _ctx)
|
|
243
266
|
@loadable_possible_types ||= read_through do |t|
|
|
244
267
|
if t.is_a?(Class) # union
|
|
268
|
+
t = t #: as singleton(GraphQL::Schema::Union)
|
|
245
269
|
t.possible_types
|
|
246
270
|
else
|
|
247
|
-
@schema.possible_types(
|
|
271
|
+
@schema.possible_types(t)
|
|
248
272
|
end
|
|
249
273
|
end
|
|
250
274
|
@loadable_possible_types[abstract_type]
|
|
251
275
|
end
|
|
252
276
|
|
|
253
|
-
#
|
|
277
|
+
# **Returns**
|
|
278
|
+
#
|
|
279
|
+
# - `GraphQL::BaseType, nil` — The type named `type_name`, if it exists (else `nil`)
|
|
280
|
+
#
|
|
281
|
+
# :call-seq:
|
|
282
|
+
# get_type(type_name) -> GraphQL::BaseType | nil
|
|
254
283
|
def get_type(type_name)
|
|
255
284
|
@visible_types ||= read_through do |name|
|
|
256
285
|
type_defn = @schema.get_type(name, @context, false)
|
|
@@ -264,18 +293,33 @@ module GraphQL
|
|
|
264
293
|
@visible_types[type_name]
|
|
265
294
|
end
|
|
266
295
|
|
|
267
|
-
#
|
|
296
|
+
# **Returns**
|
|
297
|
+
#
|
|
298
|
+
# - `Array<GraphQL::BaseType>` — Visible and reachable types in the schema
|
|
299
|
+
#
|
|
300
|
+
# :call-seq:
|
|
301
|
+
# reachable_types() -> Array[GraphQL::BaseType]
|
|
268
302
|
def reachable_types
|
|
269
303
|
@reachable_types ||= reachable_type_set.to_a
|
|
270
304
|
end
|
|
271
305
|
|
|
272
|
-
#
|
|
306
|
+
# **Returns**
|
|
307
|
+
#
|
|
308
|
+
# - `Object` — Boolean True if the type is visible and reachable in the schema
|
|
309
|
+
#
|
|
310
|
+
# :call-seq:
|
|
311
|
+
# reachable_type?(type_name) -> Object
|
|
273
312
|
def reachable_type?(type_name)
|
|
274
313
|
type = get_type(type_name) # rubocop:disable Development/ContextIsPassedCop -- `self` is query-aware
|
|
275
314
|
type && reachable_type_set.include?(type)
|
|
276
315
|
end
|
|
277
316
|
|
|
278
|
-
#
|
|
317
|
+
# **Returns**
|
|
318
|
+
#
|
|
319
|
+
# - `GraphQL::Field, nil` — The field named `field_name` on `parent_type`, if it exists
|
|
320
|
+
#
|
|
321
|
+
# :call-seq:
|
|
322
|
+
# get_field(parent_type, field_name) -> GraphQL::Field | nil
|
|
279
323
|
def get_field(parent_type, field_name)
|
|
280
324
|
@visible_parent_fields ||= read_through do |type|
|
|
281
325
|
read_through do |f_name|
|
|
@@ -291,13 +335,23 @@ module GraphQL
|
|
|
291
335
|
@visible_parent_fields[parent_type][field_name]
|
|
292
336
|
end
|
|
293
337
|
|
|
294
|
-
#
|
|
338
|
+
# **Returns**
|
|
339
|
+
#
|
|
340
|
+
# - `GraphQL::Argument, nil` — The argument named `argument_name` on `parent_type`, if it exists and is visible
|
|
341
|
+
#
|
|
342
|
+
# :call-seq:
|
|
343
|
+
# get_argument(parent_type, argument_name) -> GraphQL::Argument | nil
|
|
295
344
|
def get_argument(parent_type, argument_name)
|
|
296
345
|
argument = parent_type.get_argument(argument_name, @context)
|
|
297
346
|
return argument if argument && visible_argument?(argument, @context)
|
|
298
347
|
end
|
|
299
348
|
|
|
300
|
-
#
|
|
349
|
+
# **Returns**
|
|
350
|
+
#
|
|
351
|
+
# - `Array<GraphQL::BaseType>` — The types which may be member of `type_defn`
|
|
352
|
+
#
|
|
353
|
+
# :call-seq:
|
|
354
|
+
# possible_types(type_defn) -> Array[GraphQL::BaseType]
|
|
301
355
|
def possible_types(type_defn)
|
|
302
356
|
@visible_possible_types ||= read_through { |type_defn|
|
|
303
357
|
pt = @schema.possible_types(type_defn, @context, false)
|
|
@@ -306,15 +360,31 @@ module GraphQL
|
|
|
306
360
|
@visible_possible_types[type_defn]
|
|
307
361
|
end
|
|
308
362
|
|
|
309
|
-
#
|
|
310
|
-
#
|
|
363
|
+
# **Parameters**
|
|
364
|
+
#
|
|
365
|
+
# - `type_defn` (`GraphQL::ObjectType, GraphQL::InterfaceType`)
|
|
366
|
+
#
|
|
367
|
+
# **Returns**
|
|
368
|
+
#
|
|
369
|
+
# - `Array<GraphQL::Field>` — Fields on `type_defn`
|
|
370
|
+
#
|
|
371
|
+
# :call-seq:
|
|
372
|
+
# fields(GraphQL::ObjectType | GraphQL::InterfaceType type_defn) -> Array[GraphQL::Field]
|
|
311
373
|
def fields(type_defn)
|
|
312
374
|
@visible_fields ||= read_through { |t| @schema.get_fields(t, @context).values }
|
|
313
375
|
@visible_fields[type_defn]
|
|
314
376
|
end
|
|
315
377
|
|
|
316
|
-
#
|
|
317
|
-
#
|
|
378
|
+
# **Parameters**
|
|
379
|
+
#
|
|
380
|
+
# - `argument_owner` (`GraphQL::Field, GraphQL::InputObjectType`)
|
|
381
|
+
#
|
|
382
|
+
# **Returns**
|
|
383
|
+
#
|
|
384
|
+
# - `Array<GraphQL::Argument>` — Visible arguments on `argument_owner`
|
|
385
|
+
#
|
|
386
|
+
# :call-seq:
|
|
387
|
+
# arguments(GraphQL::Field | GraphQL::InputObjectType argument_owner, ctx) -> Array[GraphQL::Argument]
|
|
318
388
|
def arguments(argument_owner, ctx = nil)
|
|
319
389
|
@visible_arguments ||= read_through { |o|
|
|
320
390
|
args = o.arguments(@context)
|
|
@@ -329,7 +399,12 @@ module GraphQL
|
|
|
329
399
|
@visible_arguments[argument_owner]
|
|
330
400
|
end
|
|
331
401
|
|
|
332
|
-
#
|
|
402
|
+
# **Returns**
|
|
403
|
+
#
|
|
404
|
+
# - `Array<GraphQL::EnumType::EnumValue>` — Visible members of `enum_defn`
|
|
405
|
+
#
|
|
406
|
+
# :call-seq:
|
|
407
|
+
# enum_values(enum_defn) -> Array[GraphQL::EnumType::EnumValue]
|
|
333
408
|
def enum_values(enum_defn)
|
|
334
409
|
@visible_enum_arrays ||= read_through { |e|
|
|
335
410
|
values = e.enum_values(@context)
|
|
@@ -346,7 +421,12 @@ module GraphQL
|
|
|
346
421
|
@visible_enum_values[enum_value]
|
|
347
422
|
end
|
|
348
423
|
|
|
349
|
-
#
|
|
424
|
+
# **Returns**
|
|
425
|
+
#
|
|
426
|
+
# - `Array<GraphQL::InterfaceType>` — Visible interfaces implemented by `obj_type`
|
|
427
|
+
#
|
|
428
|
+
# :call-seq:
|
|
429
|
+
# interfaces(obj_type) -> Array[GraphQL::InterfaceType]
|
|
350
430
|
def interfaces(obj_type)
|
|
351
431
|
@visible_interfaces ||= read_through { |t|
|
|
352
432
|
ints = t.interfaces(@context)
|
|
@@ -371,7 +451,12 @@ module GraphQL
|
|
|
371
451
|
end
|
|
372
452
|
end
|
|
373
453
|
|
|
374
|
-
#
|
|
454
|
+
# **Parameters**
|
|
455
|
+
#
|
|
456
|
+
# - `owner` (`Class, Module`) — If provided, confirm that field has the given owner.
|
|
457
|
+
#
|
|
458
|
+
# :call-seq:
|
|
459
|
+
# visible_field?(field_defn, _ctx, Class | Module owner)
|
|
375
460
|
def visible_field?(field_defn, _ctx = nil, owner = field_defn.owner)
|
|
376
461
|
# This field is visible in its own right
|
|
377
462
|
visible?(field_defn) &&
|
|
@@ -453,8 +538,8 @@ module GraphQL
|
|
|
453
538
|
# (If it _wasn't_ inherited, then don't hide it for this reason.)
|
|
454
539
|
def field_on_visible_interface?(field_defn, type_defn)
|
|
455
540
|
if type_defn.kind.object?
|
|
456
|
-
any_interface_has_field = false
|
|
457
|
-
any_interface_has_visible_field = false
|
|
541
|
+
any_interface_has_field = false #: bool
|
|
542
|
+
any_interface_has_visible_field = false #: bool
|
|
458
543
|
ints = unfiltered_interfaces(type_defn)
|
|
459
544
|
ints.each do |interface_type|
|
|
460
545
|
if (iface_field_defn = interface_type.get_field(field_defn.graphql_name, @context))
|
|
@@ -510,6 +595,7 @@ module GraphQL
|
|
|
510
595
|
member_type = case member
|
|
511
596
|
when Module
|
|
512
597
|
if member.respond_to?(:kind)
|
|
598
|
+
member = member #: as GraphQL::Schema::Member::type_definition
|
|
513
599
|
member.kind.name.downcase
|
|
514
600
|
else
|
|
515
601
|
""
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
+
# typed: true
|
|
2
3
|
|
|
3
4
|
module GraphQL
|
|
4
5
|
class Schema
|
|
5
6
|
class Wrapper
|
|
6
7
|
include GraphQL::Schema::Member::TypeSystemHelpers
|
|
7
8
|
|
|
8
|
-
#
|
|
9
|
+
# **Returns**
|
|
10
|
+
#
|
|
11
|
+
# - `Class, Module` — The inner type of this wrapping type, the type of which one or more objects may be present.
|
|
9
12
|
attr_reader :of_type
|
|
10
13
|
|
|
11
14
|
def initialize(of_type)
|