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
|
|
|
3
4
|
module GraphQL
|
|
4
5
|
module Tracing
|
|
@@ -6,8 +7,7 @@ module GraphQL
|
|
|
6
7
|
# - `.platform_keys`
|
|
7
8
|
# - `#platform_trace`
|
|
8
9
|
# - `#platform_field_key(type, field)`
|
|
9
|
-
#
|
|
10
|
-
class PlatformTracing
|
|
10
|
+
class PlatformTracing # :nodoc:
|
|
11
11
|
class << self
|
|
12
12
|
attr_accessor :platform_keys
|
|
13
13
|
|
|
@@ -77,7 +77,8 @@ module GraphQL
|
|
|
77
77
|
tracer = self.new(**options)
|
|
78
78
|
schema_defn.tracer(tracer)
|
|
79
79
|
else
|
|
80
|
-
|
|
80
|
+
class_name = self.name #: as !nil
|
|
81
|
+
tracing_name = class_name.split("::").last #: as String
|
|
81
82
|
trace_name = tracing_name.sub("Tracing", "Trace")
|
|
82
83
|
if GraphQL::Tracing.const_defined?(trace_name, false)
|
|
83
84
|
trace_module = GraphQL::Tracing.const_get(trace_name)
|
|
@@ -123,10 +124,18 @@ module GraphQL
|
|
|
123
124
|
#
|
|
124
125
|
# If the key isn't present, the given block is called and the result is cached for `key`.
|
|
125
126
|
#
|
|
126
|
-
#
|
|
127
|
-
#
|
|
128
|
-
#
|
|
129
|
-
#
|
|
127
|
+
# **Parameters**
|
|
128
|
+
#
|
|
129
|
+
# - `ctx` (`GraphQL::Query::Context`)
|
|
130
|
+
# - `key` (`Class, GraphQL::Field`) — A part of the schema
|
|
131
|
+
# - `trace_phase` (`Symbol`) — The stage of execution being traced (used by OpenTelementry tracing)
|
|
132
|
+
#
|
|
133
|
+
# **Returns**
|
|
134
|
+
#
|
|
135
|
+
# - `String`
|
|
136
|
+
#
|
|
137
|
+
# :call-seq:
|
|
138
|
+
# cached_platform_key(GraphQL::Query::Context ctx, Class | GraphQL::Field key, Symbol trace_phase) -> String
|
|
130
139
|
def cached_platform_key(ctx, key, trace_phase)
|
|
131
140
|
cache = ctx.namespace(self.class)[:platform_key_cache] ||= {}
|
|
132
141
|
cache.fetch(key) { cache[key] = yield }
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
+
# typed: ignore
|
|
2
3
|
|
|
3
4
|
require "graphql/tracing/monitor_trace"
|
|
4
5
|
|
|
@@ -8,24 +9,32 @@ module GraphQL
|
|
|
8
9
|
#
|
|
9
10
|
# The PrometheusExporter server must be run with a custom type collector that extends `GraphQL::Tracing::PrometheusTracing::GraphQLCollector`.
|
|
10
11
|
#
|
|
11
|
-
#
|
|
12
|
-
# require 'prometheus_exporter/client'
|
|
12
|
+
# **Examples**
|
|
13
13
|
#
|
|
14
|
-
#
|
|
15
|
-
#
|
|
16
|
-
#
|
|
14
|
+
# **Example: Adding this trace to your schema**
|
|
15
|
+
#
|
|
16
|
+
# ```ruby
|
|
17
|
+
# require 'prometheus_exporter/client'
|
|
18
|
+
#
|
|
19
|
+
# class MySchema < GraphQL::Schema
|
|
20
|
+
# trace_with GraphQL::Tracing::PrometheusTrace
|
|
21
|
+
# end
|
|
22
|
+
# ```
|
|
23
|
+
#
|
|
24
|
+
# **Example: Running a custom type collector**
|
|
17
25
|
#
|
|
18
|
-
#
|
|
19
|
-
#
|
|
20
|
-
#
|
|
21
|
-
#
|
|
26
|
+
# ```ruby
|
|
27
|
+
# # lib/graphql_collector.rb
|
|
28
|
+
# if defined?(PrometheusExporter::Server)
|
|
29
|
+
# require 'graphql/tracing'
|
|
22
30
|
#
|
|
23
|
-
#
|
|
24
|
-
# end
|
|
31
|
+
# class GraphQLCollector < GraphQL::Tracing::PrometheusTrace::GraphQLCollector
|
|
25
32
|
# end
|
|
33
|
+
# end
|
|
26
34
|
#
|
|
27
|
-
#
|
|
28
|
-
#
|
|
35
|
+
# # Then run:
|
|
36
|
+
# # bundle exec prometheus_exporter -a lib/graphql_collector.rb
|
|
37
|
+
# ```
|
|
29
38
|
PrometheusTrace = MonitorTrace.create_module("prometheus")
|
|
30
39
|
module PrometheusTrace
|
|
31
40
|
if defined?(PrometheusExporter::Server)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
+
# typed: ignore
|
|
2
3
|
|
|
3
4
|
require "graphql/tracing/monitor_trace"
|
|
4
5
|
|
|
@@ -6,10 +7,15 @@ module GraphQL
|
|
|
6
7
|
module Tracing
|
|
7
8
|
# A tracer for sending GraphQL-Ruby times to Scout
|
|
8
9
|
#
|
|
9
|
-
#
|
|
10
|
-
#
|
|
11
|
-
#
|
|
12
|
-
#
|
|
10
|
+
# **Examples**
|
|
11
|
+
#
|
|
12
|
+
# **Example: Adding this tracer to your schema**
|
|
13
|
+
#
|
|
14
|
+
# ```ruby
|
|
15
|
+
# class MySchema < GraphQL::Schema
|
|
16
|
+
# trace_with GraphQL::Tracing::ScoutTrace
|
|
17
|
+
# end
|
|
18
|
+
# ```
|
|
13
19
|
ScoutTrace = MonitorTrace.create_module("scout")
|
|
14
20
|
module ScoutTrace
|
|
15
21
|
class ScoutMonitor < MonitorTrace::Monitor
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
+
# typed: true
|
|
2
3
|
|
|
3
4
|
require "graphql/tracing/platform_tracing"
|
|
4
5
|
|
|
@@ -18,9 +19,12 @@ module GraphQL
|
|
|
18
19
|
"execute_query_lazy" => "execute.graphql",
|
|
19
20
|
}
|
|
20
21
|
|
|
21
|
-
#
|
|
22
|
-
#
|
|
23
|
-
#
|
|
22
|
+
# **Parameters**
|
|
23
|
+
#
|
|
24
|
+
# - `set_transaction_name` (`Boolean`) — If true, the GraphQL operation name will be used as the transaction name. This is not advised if you run more than one query per HTTP request, for example, with `graphql-client` or multiplexing. It can also be specified per-query with `context[:set_scout_transaction_name]`.
|
|
25
|
+
#
|
|
26
|
+
# :call-seq:
|
|
27
|
+
# initialize(options)
|
|
24
28
|
def initialize(options = {})
|
|
25
29
|
self.class.include ScoutApm::Tracer
|
|
26
30
|
@set_transaction_name = options.fetch(:set_transaction_name, false)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
+
# typed: ignore
|
|
2
3
|
|
|
3
4
|
require "graphql/tracing/monitor_trace"
|
|
4
5
|
|
|
@@ -6,11 +7,17 @@ module GraphQL
|
|
|
6
7
|
module Tracing
|
|
7
8
|
# A tracer for reporting GraphQL-Ruby times to Sentry.
|
|
8
9
|
#
|
|
9
|
-
#
|
|
10
|
-
#
|
|
11
|
-
#
|
|
12
|
-
#
|
|
13
|
-
#
|
|
10
|
+
# See [MonitorTrace](rdoc-ref:MonitorTrace) Configuration Options in the parent module
|
|
11
|
+
#
|
|
12
|
+
# **Examples**
|
|
13
|
+
#
|
|
14
|
+
# **Example: Installing the tracer**
|
|
15
|
+
#
|
|
16
|
+
# ```ruby
|
|
17
|
+
# class MySchema < GraphQL::Schema
|
|
18
|
+
# trace_with GraphQL::Tracing::SentryTrace
|
|
19
|
+
# end
|
|
20
|
+
# ```
|
|
14
21
|
SentryTrace = MonitorTrace.create_module("sentry")
|
|
15
22
|
module SentryTrace
|
|
16
23
|
class SentryMonitor < MonitorTrace::Monitor
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
+
# typed: ignore
|
|
2
3
|
|
|
3
4
|
require "graphql/tracing/monitor_trace"
|
|
4
5
|
|
|
@@ -8,12 +9,17 @@ module GraphQL
|
|
|
8
9
|
# Passing any Statsd client that implements `.time(name) { ... }`
|
|
9
10
|
# and `.timing(name, ms)` will work.
|
|
10
11
|
#
|
|
11
|
-
#
|
|
12
|
-
#
|
|
13
|
-
#
|
|
14
|
-
#
|
|
15
|
-
#
|
|
16
|
-
#
|
|
12
|
+
# **Examples**
|
|
13
|
+
#
|
|
14
|
+
# **Example: Installing this tracer**
|
|
15
|
+
#
|
|
16
|
+
# ```ruby
|
|
17
|
+
# # eg:
|
|
18
|
+
# # $statsd = Statsd.new 'localhost', 9125
|
|
19
|
+
# class MySchema < GraphQL::Schema
|
|
20
|
+
# use GraphQL::Tracing::StatsdTrace, statsd: $statsd
|
|
21
|
+
# end
|
|
22
|
+
# ```
|
|
17
23
|
StatsdTrace = MonitorTrace.create_module("statsd")
|
|
18
24
|
module StatsdTrace
|
|
19
25
|
class StatsdMonitor < MonitorTrace::Monitor
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
+
# typed: true
|
|
2
3
|
|
|
3
4
|
require "graphql/tracing/platform_tracing"
|
|
4
5
|
|
|
@@ -16,7 +17,12 @@ module GraphQL
|
|
|
16
17
|
'execute_query_lazy' => "graphql.execute_query_lazy",
|
|
17
18
|
}
|
|
18
19
|
|
|
19
|
-
#
|
|
20
|
+
# **Parameters**
|
|
21
|
+
#
|
|
22
|
+
# - `statsd` (`Object`) — A statsd client
|
|
23
|
+
#
|
|
24
|
+
# :call-seq:
|
|
25
|
+
# initialize(Object statsd:, **rest)
|
|
20
26
|
def initialize(statsd:, **rest)
|
|
21
27
|
@statsd = statsd
|
|
22
28
|
super(**rest)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
+
# typed: true
|
|
2
3
|
|
|
3
4
|
require "graphql/tracing"
|
|
4
5
|
|
|
@@ -11,8 +12,13 @@ module GraphQL
|
|
|
11
12
|
# to continue any tracing hooks and call the actual runtime behavior.
|
|
12
13
|
#
|
|
13
14
|
class Trace
|
|
14
|
-
#
|
|
15
|
-
#
|
|
15
|
+
# **Parameters**
|
|
16
|
+
#
|
|
17
|
+
# - `multiplex` (`GraphQL::Execution::Multiplex, nil`)
|
|
18
|
+
# - `query` (`GraphQL::Query, nil`)
|
|
19
|
+
#
|
|
20
|
+
# :call-seq:
|
|
21
|
+
# initialize(GraphQL::Execution::Multiplex | nil multiplex:, GraphQL::Query | nil query:, **_options)
|
|
16
22
|
def initialize(multiplex: nil, query: nil, **_options)
|
|
17
23
|
@multiplex = multiplex
|
|
18
24
|
@query = query
|
|
@@ -23,8 +29,16 @@ module GraphQL
|
|
|
23
29
|
yield
|
|
24
30
|
end
|
|
25
31
|
|
|
26
|
-
#
|
|
27
|
-
#
|
|
32
|
+
# **Parameters**
|
|
33
|
+
#
|
|
34
|
+
# - `query_string` (`String`)
|
|
35
|
+
#
|
|
36
|
+
# **Returns**
|
|
37
|
+
#
|
|
38
|
+
# - `void`
|
|
39
|
+
#
|
|
40
|
+
# :call-seq:
|
|
41
|
+
# parse(String query_string:) -> void
|
|
28
42
|
def parse(query_string:)
|
|
29
43
|
yield
|
|
30
44
|
end
|
|
@@ -39,16 +53,40 @@ module GraphQL
|
|
|
39
53
|
def end_validate(query, validate, errors)
|
|
40
54
|
end
|
|
41
55
|
|
|
42
|
-
#
|
|
43
|
-
#
|
|
44
|
-
#
|
|
56
|
+
# **Parameters**
|
|
57
|
+
#
|
|
58
|
+
# - `multiplex` (`GraphQL::Execution::Multiplex`)
|
|
59
|
+
# - `analyzers` (`Array<Class>`)
|
|
60
|
+
#
|
|
61
|
+
# **Returns**
|
|
62
|
+
#
|
|
63
|
+
# - `void`
|
|
64
|
+
#
|
|
65
|
+
# :call-seq:
|
|
66
|
+
# begin_analyze_multiplex(GraphQL::Execution::Multiplex multiplex, Array[Class] analyzers) -> void
|
|
45
67
|
def begin_analyze_multiplex(multiplex, analyzers); end
|
|
46
|
-
#
|
|
47
|
-
#
|
|
48
|
-
#
|
|
68
|
+
# **Parameters**
|
|
69
|
+
#
|
|
70
|
+
# - `multiplex` (`GraphQL::Execution::Multiplex`)
|
|
71
|
+
# - `analyzers` (`Array<Class>`)
|
|
72
|
+
#
|
|
73
|
+
# **Returns**
|
|
74
|
+
#
|
|
75
|
+
# - `void`
|
|
76
|
+
#
|
|
77
|
+
# :call-seq:
|
|
78
|
+
# end_analyze_multiplex(GraphQL::Execution::Multiplex multiplex, Array[Class] analyzers) -> void
|
|
49
79
|
def end_analyze_multiplex(multiplex, analyzers); end
|
|
50
|
-
#
|
|
51
|
-
#
|
|
80
|
+
# **Parameters**
|
|
81
|
+
#
|
|
82
|
+
# - `multiplex` (`GraphQL::Execution::Multiplex`)
|
|
83
|
+
#
|
|
84
|
+
# **Returns**
|
|
85
|
+
#
|
|
86
|
+
# - `void`
|
|
87
|
+
#
|
|
88
|
+
# :call-seq:
|
|
89
|
+
# analyze_multiplex(GraphQL::Execution::Multiplex multiplex:) -> void
|
|
52
90
|
def analyze_multiplex(multiplex:)
|
|
53
91
|
yield
|
|
54
92
|
end
|
|
@@ -58,8 +96,17 @@ module GraphQL
|
|
|
58
96
|
end
|
|
59
97
|
|
|
60
98
|
# This wraps an entire `.execute` call.
|
|
61
|
-
#
|
|
62
|
-
#
|
|
99
|
+
#
|
|
100
|
+
# **Parameters**
|
|
101
|
+
#
|
|
102
|
+
# - `multiplex` (`GraphQL::Execution::Multiplex`)
|
|
103
|
+
#
|
|
104
|
+
# **Returns**
|
|
105
|
+
#
|
|
106
|
+
# - `void`
|
|
107
|
+
#
|
|
108
|
+
# :call-seq:
|
|
109
|
+
# execute_multiplex(GraphQL::Execution::Multiplex multiplex:) -> void
|
|
63
110
|
def execute_multiplex(multiplex:)
|
|
64
111
|
yield
|
|
65
112
|
end
|
|
@@ -73,17 +120,29 @@ module GraphQL
|
|
|
73
120
|
end
|
|
74
121
|
|
|
75
122
|
# GraphQL is about to resolve this field
|
|
76
|
-
#
|
|
77
|
-
#
|
|
78
|
-
#
|
|
79
|
-
#
|
|
123
|
+
#
|
|
124
|
+
# **Parameters**
|
|
125
|
+
#
|
|
126
|
+
# - `field` (`GraphQL::Schema::Field`)
|
|
127
|
+
# - `object` (`GraphQL::Schema::Object`)
|
|
128
|
+
# - `arguments` (`Hash`)
|
|
129
|
+
# - `query` (`GraphQL::Query`)
|
|
130
|
+
#
|
|
131
|
+
# :call-seq:
|
|
132
|
+
# begin_execute_field(GraphQL::Schema::Field field, GraphQL::Schema::Object object, Hash arguments, GraphQL::Query query)
|
|
80
133
|
def begin_execute_field(field, object, arguments, query); end
|
|
81
134
|
# GraphQL just finished resolving this field
|
|
82
|
-
#
|
|
83
|
-
#
|
|
84
|
-
#
|
|
85
|
-
#
|
|
86
|
-
#
|
|
135
|
+
#
|
|
136
|
+
# **Parameters**
|
|
137
|
+
#
|
|
138
|
+
# - `field` (`GraphQL::Schema::Field`)
|
|
139
|
+
# - `object` (`GraphQL::Schema::Object`)
|
|
140
|
+
# - `arguments` (`Hash`)
|
|
141
|
+
# - `query` (`GraphQL::Query`)
|
|
142
|
+
# - `result` (`Object`)
|
|
143
|
+
#
|
|
144
|
+
# :call-seq:
|
|
145
|
+
# end_execute_field(GraphQL::Schema::Field field, GraphQL::Schema::Object object, Hash arguments, GraphQL::Query query, Object result)
|
|
87
146
|
def end_execute_field(field, object, arguments, query, result); end
|
|
88
147
|
|
|
89
148
|
def execute_field(field:, query:, ast_node:, arguments:, object:)
|
|
@@ -105,18 +164,36 @@ module GraphQL
|
|
|
105
164
|
end
|
|
106
165
|
|
|
107
166
|
# A call to `.authorized?` is starting
|
|
108
|
-
#
|
|
109
|
-
#
|
|
110
|
-
#
|
|
111
|
-
#
|
|
167
|
+
#
|
|
168
|
+
# **Parameters**
|
|
169
|
+
#
|
|
170
|
+
# - `type` (`Class<GraphQL::Schema::Object>`)
|
|
171
|
+
# - `object` (`Object`)
|
|
172
|
+
# - `context` (`GraphQL::Query::Context`)
|
|
173
|
+
#
|
|
174
|
+
# **Returns**
|
|
175
|
+
#
|
|
176
|
+
# - `void`
|
|
177
|
+
#
|
|
178
|
+
# :call-seq:
|
|
179
|
+
# begin_authorized(Class[GraphQL::Schema::Object] type, Object object, GraphQL::Query::Context context) -> void
|
|
112
180
|
def begin_authorized(type, object, context)
|
|
113
181
|
end
|
|
114
182
|
# A call to `.authorized?` just finished
|
|
115
|
-
#
|
|
116
|
-
#
|
|
117
|
-
#
|
|
118
|
-
#
|
|
119
|
-
#
|
|
183
|
+
#
|
|
184
|
+
# **Parameters**
|
|
185
|
+
#
|
|
186
|
+
# - `type` (`Class<GraphQL::Schema::Object>`)
|
|
187
|
+
# - `object` (`Object`)
|
|
188
|
+
# - `context` (`GraphQL::Query::Context`)
|
|
189
|
+
# - `authorized_result` (`Boolean`)
|
|
190
|
+
#
|
|
191
|
+
# **Returns**
|
|
192
|
+
#
|
|
193
|
+
# - `void`
|
|
194
|
+
#
|
|
195
|
+
# :call-seq:
|
|
196
|
+
# end_authorized(Class[GraphQL::Schema::Object] type, Object object, GraphQL::Query::Context context, bool authorized_result) -> void
|
|
120
197
|
def end_authorized(type, object, context, authorized_result)
|
|
121
198
|
end
|
|
122
199
|
|
|
@@ -133,59 +210,155 @@ module GraphQL
|
|
|
133
210
|
end
|
|
134
211
|
|
|
135
212
|
# A call to `.resolve_type` is starting
|
|
136
|
-
#
|
|
137
|
-
#
|
|
138
|
-
#
|
|
139
|
-
#
|
|
213
|
+
#
|
|
214
|
+
# **Parameters**
|
|
215
|
+
#
|
|
216
|
+
# - `type` (`Class<GraphQL::Schema::Union>, Module<GraphQL::Schema::Interface>`)
|
|
217
|
+
# - `value` (`Object`)
|
|
218
|
+
# - `context` (`GraphQL::Query::Context`)
|
|
219
|
+
#
|
|
220
|
+
# **Returns**
|
|
221
|
+
#
|
|
222
|
+
# - `void`
|
|
223
|
+
#
|
|
224
|
+
# :call-seq:
|
|
225
|
+
# begin_resolve_type(Class[GraphQL::Schema::Union] | Module[GraphQL::Schema::Interface] type, Object value, GraphQL::Query::Context context) -> void
|
|
140
226
|
def begin_resolve_type(type, value, context)
|
|
141
227
|
end
|
|
142
228
|
|
|
143
229
|
# A call to `.resolve_type` just ended
|
|
144
|
-
#
|
|
145
|
-
#
|
|
146
|
-
#
|
|
147
|
-
#
|
|
148
|
-
#
|
|
230
|
+
#
|
|
231
|
+
# **Parameters**
|
|
232
|
+
#
|
|
233
|
+
# - `type` (`Class<GraphQL::Schema::Union>, Module<GraphQL::Schema::Interface>`)
|
|
234
|
+
# - `value` (`Object`)
|
|
235
|
+
# - `context` (`GraphQL::Query::Context`)
|
|
236
|
+
# - `resolved_type` (`Class<GraphQL::Schema::Object>`)
|
|
237
|
+
#
|
|
238
|
+
# **Returns**
|
|
239
|
+
#
|
|
240
|
+
# - `void`
|
|
241
|
+
#
|
|
242
|
+
# :call-seq:
|
|
243
|
+
# end_resolve_type(Class[GraphQL::Schema::Union] | Module[GraphQL::Schema::Interface] type, Object value, GraphQL::Query::Context context, Class[GraphQL::Schema::Object] resolved_type) -> void
|
|
149
244
|
def end_resolve_type(type, value, context, resolved_type)
|
|
150
245
|
end
|
|
151
246
|
|
|
152
247
|
# A dataloader run is starting
|
|
153
|
-
#
|
|
154
|
-
#
|
|
248
|
+
#
|
|
249
|
+
# **Parameters**
|
|
250
|
+
#
|
|
251
|
+
# - `dataloader` (`GraphQL::Dataloader`)
|
|
252
|
+
#
|
|
253
|
+
# **Returns**
|
|
254
|
+
#
|
|
255
|
+
# - `void`
|
|
256
|
+
#
|
|
257
|
+
# :call-seq:
|
|
258
|
+
# begin_dataloader(GraphQL::Dataloader dataloader) -> void
|
|
155
259
|
def begin_dataloader(dataloader); end
|
|
156
260
|
# A dataloader run has ended
|
|
157
|
-
#
|
|
158
|
-
#
|
|
261
|
+
#
|
|
262
|
+
# **Parameters**
|
|
263
|
+
#
|
|
264
|
+
# - `dataloder` (`GraphQL::Dataloader`)
|
|
265
|
+
#
|
|
266
|
+
# **Returns**
|
|
267
|
+
#
|
|
268
|
+
# - `void`
|
|
269
|
+
#
|
|
270
|
+
# :call-seq:
|
|
271
|
+
# end_dataloader(dataloader) -> void
|
|
159
272
|
def end_dataloader(dataloader); end
|
|
160
273
|
|
|
161
274
|
# A source with pending keys is about to fetch
|
|
162
|
-
#
|
|
163
|
-
#
|
|
275
|
+
#
|
|
276
|
+
# **Parameters**
|
|
277
|
+
#
|
|
278
|
+
# - `source` (`GraphQL::Dataloader::Source`)
|
|
279
|
+
#
|
|
280
|
+
# **Returns**
|
|
281
|
+
#
|
|
282
|
+
# - `void`
|
|
283
|
+
#
|
|
284
|
+
# :call-seq:
|
|
285
|
+
# begin_dataloader_source(GraphQL::Dataloader::Source source) -> void
|
|
164
286
|
def begin_dataloader_source(source); end
|
|
165
287
|
# A fetch call has just ended
|
|
166
|
-
#
|
|
167
|
-
#
|
|
288
|
+
#
|
|
289
|
+
# **Parameters**
|
|
290
|
+
#
|
|
291
|
+
# - `source` (`GraphQL::Dataloader::Source`)
|
|
292
|
+
#
|
|
293
|
+
# **Returns**
|
|
294
|
+
#
|
|
295
|
+
# - `void`
|
|
296
|
+
#
|
|
297
|
+
# :call-seq:
|
|
298
|
+
# end_dataloader_source(GraphQL::Dataloader::Source source) -> void
|
|
168
299
|
def end_dataloader_source(source); end
|
|
169
300
|
|
|
170
301
|
# Called when Dataloader spins up a new fiber for GraphQL execution
|
|
171
|
-
#
|
|
172
|
-
#
|
|
302
|
+
#
|
|
303
|
+
# **Parameters**
|
|
304
|
+
#
|
|
305
|
+
# - `jobs` (`Array<#call>`) — Execution steps to run
|
|
306
|
+
#
|
|
307
|
+
# **Returns**
|
|
308
|
+
#
|
|
309
|
+
# - `void`
|
|
310
|
+
#
|
|
311
|
+
# :call-seq:
|
|
312
|
+
# dataloader_spawn_execution_fiber(Array[#call] jobs) -> void
|
|
173
313
|
def dataloader_spawn_execution_fiber(jobs); end
|
|
174
314
|
# Called when Dataloader spins up a new fiber for fetching data
|
|
175
|
-
#
|
|
176
|
-
#
|
|
315
|
+
#
|
|
316
|
+
# **Parameters**
|
|
317
|
+
#
|
|
318
|
+
# - `pending_sources` (`GraphQL::Dataloader::Source`) — Instances with pending keys
|
|
319
|
+
#
|
|
320
|
+
# **Returns**
|
|
321
|
+
#
|
|
322
|
+
# - `void`
|
|
323
|
+
#
|
|
324
|
+
# :call-seq:
|
|
325
|
+
# dataloader_spawn_source_fiber(GraphQL::Dataloader::Source pending_sources) -> void
|
|
177
326
|
def dataloader_spawn_source_fiber(pending_sources); end
|
|
178
327
|
# Called when an execution or source fiber terminates
|
|
179
|
-
#
|
|
328
|
+
#
|
|
329
|
+
# **Returns**
|
|
330
|
+
#
|
|
331
|
+
# - `void`
|
|
332
|
+
#
|
|
333
|
+
# :call-seq:
|
|
334
|
+
# dataloader_fiber_exit;() -> void
|
|
180
335
|
def dataloader_fiber_exit; end
|
|
181
336
|
|
|
182
337
|
# Called when a Dataloader fiber is paused to wait for data
|
|
183
|
-
#
|
|
184
|
-
#
|
|
338
|
+
#
|
|
339
|
+
# **Parameters**
|
|
340
|
+
#
|
|
341
|
+
# - `source` (`GraphQL::Dataloader::Source`) — The Source whose `load` call initiated this `yield`
|
|
342
|
+
#
|
|
343
|
+
# **Returns**
|
|
344
|
+
#
|
|
345
|
+
# - `void`
|
|
346
|
+
#
|
|
347
|
+
# :call-seq:
|
|
348
|
+
# dataloader_fiber_yield(GraphQL::Dataloader::Source source) -> void
|
|
185
349
|
def dataloader_fiber_yield(source); end
|
|
186
350
|
# Called when a Dataloader fiber is resumed because data has been loaded
|
|
187
|
-
#
|
|
188
|
-
#
|
|
351
|
+
#
|
|
352
|
+
# **Parameters**
|
|
353
|
+
#
|
|
354
|
+
# - `source` (`GraphQL::Dataloader::Source`) — The Source whose `load` call previously caused this Fiber to wait
|
|
355
|
+
#
|
|
356
|
+
# **Returns**
|
|
357
|
+
#
|
|
358
|
+
# - `void`
|
|
359
|
+
#
|
|
360
|
+
# :call-seq:
|
|
361
|
+
# dataloader_fiber_resume(GraphQL::Dataloader::Source source) -> void
|
|
189
362
|
def dataloader_fiber_resume(source); end
|
|
190
363
|
end
|
|
191
364
|
end
|
data/lib/graphql/tracing.rb
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
+
# typed: true
|
|
2
3
|
|
|
3
4
|
|
|
4
5
|
module GraphQL
|
|
@@ -37,11 +38,18 @@ module GraphQL
|
|
|
37
38
|
|
|
38
39
|
# Objects may include traceable to gain a `.trace(...)` method.
|
|
39
40
|
# The object must have a `@tracers` ivar of type `Array<<#trace(k, d, &b)>>`.
|
|
40
|
-
#
|
|
41
|
-
|
|
42
|
-
#
|
|
43
|
-
#
|
|
44
|
-
#
|
|
41
|
+
module Traceable # :nodoc:
|
|
42
|
+
# **Parameters**
|
|
43
|
+
#
|
|
44
|
+
# - `key` (`String`) — The name of the event in GraphQL internals
|
|
45
|
+
# - `metadata` (`Hash`) — Event-related metadata (can be anything)
|
|
46
|
+
#
|
|
47
|
+
# **Returns**
|
|
48
|
+
#
|
|
49
|
+
# - `Object` — Must return the value of the block
|
|
50
|
+
#
|
|
51
|
+
# :call-seq:
|
|
52
|
+
# trace(String key, Hash metadata, &block) -> Object
|
|
45
53
|
def trace(key, metadata, &block)
|
|
46
54
|
return yield if @tracers.empty?
|
|
47
55
|
call_tracers(0, key, metadata, &block)
|
|
@@ -52,10 +60,18 @@ module GraphQL
|
|
|
52
60
|
# If there's a tracer at `idx`, call it and then increment `idx`.
|
|
53
61
|
# Otherwise, yield.
|
|
54
62
|
#
|
|
55
|
-
#
|
|
56
|
-
#
|
|
57
|
-
#
|
|
58
|
-
#
|
|
63
|
+
# **Parameters**
|
|
64
|
+
#
|
|
65
|
+
# - `idx` (`Integer`) — Which tracer to call
|
|
66
|
+
# - `key` (`String`) — The current event name
|
|
67
|
+
# - `metadata` (`Object`) — The current event object
|
|
68
|
+
#
|
|
69
|
+
# **Returns**
|
|
70
|
+
#
|
|
71
|
+
# - `Object` — Whatever the block returns
|
|
72
|
+
#
|
|
73
|
+
# :call-seq:
|
|
74
|
+
# call_tracers(Integer idx, String key, Object metadata, &block) -> Object
|
|
59
75
|
def call_tracers(idx, key, metadata, &block)
|
|
60
76
|
if idx == @tracers.length
|
|
61
77
|
yield
|
data/lib/graphql/type_kinds.rb
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
+
# typed: true
|
|
2
3
|
module GraphQL
|
|
3
4
|
# Type kinds are the basic categories which a type may belong to (`Object`, `Scalar`, `Union`...)
|
|
4
5
|
module TypeKinds
|
|
@@ -18,7 +19,7 @@ module GraphQL
|
|
|
18
19
|
end
|
|
19
20
|
|
|
20
21
|
# Does this TypeKind have multiple possible implementers?
|
|
21
|
-
#
|
|
22
|
+
# **Deprecated:** Use `abstract?` instead of `resolves?`.
|
|
22
23
|
def resolves?; @abstract; end
|
|
23
24
|
# Is this TypeKind abstract?
|
|
24
25
|
def abstract?; @abstract; end
|