graphql 2.0.32 → 2.5.22
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/lib/generators/graphql/detailed_trace_generator.rb +77 -0
- data/lib/generators/graphql/install/mutation_root_generator.rb +2 -2
- data/lib/generators/graphql/install/templates/base_mutation.erb +2 -0
- data/lib/generators/graphql/install/templates/mutation_type.erb +2 -0
- data/lib/generators/graphql/install_generator.rb +49 -0
- data/lib/generators/graphql/orm_mutations_base.rb +1 -1
- data/lib/generators/graphql/templates/base_argument.erb +2 -0
- data/lib/generators/graphql/templates/base_connection.erb +2 -0
- data/lib/generators/graphql/templates/base_edge.erb +2 -0
- data/lib/generators/graphql/templates/base_enum.erb +2 -0
- data/lib/generators/graphql/templates/base_field.erb +2 -0
- data/lib/generators/graphql/templates/base_input_object.erb +2 -0
- data/lib/generators/graphql/templates/base_interface.erb +2 -0
- data/lib/generators/graphql/templates/base_object.erb +2 -0
- data/lib/generators/graphql/templates/base_resolver.erb +8 -0
- data/lib/generators/graphql/templates/base_scalar.erb +2 -0
- data/lib/generators/graphql/templates/base_union.erb +2 -0
- data/lib/generators/graphql/templates/create_graphql_detailed_traces.erb +10 -0
- data/lib/generators/graphql/templates/graphql_controller.erb +2 -0
- data/lib/generators/graphql/templates/loader.erb +2 -0
- data/lib/generators/graphql/templates/mutation.erb +2 -0
- data/lib/generators/graphql/templates/node_type.erb +2 -0
- data/lib/generators/graphql/templates/query_type.erb +2 -0
- data/lib/generators/graphql/templates/schema.erb +5 -0
- data/lib/generators/graphql/type_generator.rb +1 -1
- data/lib/graphql/analysis/analyzer.rb +90 -0
- data/lib/graphql/analysis/field_usage.rb +82 -0
- data/lib/graphql/analysis/max_query_complexity.rb +20 -0
- data/lib/graphql/analysis/max_query_depth.rb +20 -0
- data/lib/graphql/analysis/query_complexity.rb +263 -0
- data/lib/graphql/analysis/query_depth.rb +58 -0
- data/lib/graphql/analysis/visitor.rb +280 -0
- data/lib/graphql/analysis.rb +95 -1
- data/lib/graphql/autoload.rb +38 -0
- data/lib/graphql/backtrace/table.rb +118 -55
- data/lib/graphql/backtrace.rb +1 -19
- data/lib/graphql/coercion_error.rb +1 -9
- data/lib/graphql/current.rb +57 -0
- data/lib/graphql/dashboard/application_controller.rb +41 -0
- data/lib/graphql/dashboard/detailed_traces.rb +47 -0
- data/lib/graphql/dashboard/installable.rb +22 -0
- data/lib/graphql/dashboard/landings_controller.rb +9 -0
- data/lib/graphql/dashboard/limiters.rb +93 -0
- data/lib/graphql/dashboard/operation_store.rb +199 -0
- data/lib/graphql/dashboard/statics/bootstrap-5.3.3.min.css +6 -0
- data/lib/graphql/dashboard/statics/bootstrap-5.3.3.min.js +7 -0
- data/lib/graphql/dashboard/statics/charts.min.css +1 -0
- data/lib/graphql/dashboard/statics/dashboard.css +30 -0
- data/lib/graphql/dashboard/statics/dashboard.js +143 -0
- data/lib/graphql/dashboard/statics/header-icon.png +0 -0
- data/lib/graphql/dashboard/statics/icon.png +0 -0
- data/lib/graphql/dashboard/statics_controller.rb +31 -0
- data/lib/graphql/dashboard/subscriptions.rb +97 -0
- data/lib/graphql/dashboard/views/graphql/dashboard/detailed_traces/traces/index.html.erb +45 -0
- data/lib/graphql/dashboard/views/graphql/dashboard/landings/show.html.erb +18 -0
- data/lib/graphql/dashboard/views/graphql/dashboard/limiters/limiters/show.html.erb +62 -0
- data/lib/graphql/dashboard/views/graphql/dashboard/not_installed.html.erb +18 -0
- data/lib/graphql/dashboard/views/graphql/dashboard/operation_store/clients/_form.html.erb +24 -0
- data/lib/graphql/dashboard/views/graphql/dashboard/operation_store/clients/edit.html.erb +21 -0
- data/lib/graphql/dashboard/views/graphql/dashboard/operation_store/clients/index.html.erb +69 -0
- data/lib/graphql/dashboard/views/graphql/dashboard/operation_store/clients/new.html.erb +7 -0
- data/lib/graphql/dashboard/views/graphql/dashboard/operation_store/index_entries/index.html.erb +39 -0
- data/lib/graphql/dashboard/views/graphql/dashboard/operation_store/index_entries/show.html.erb +32 -0
- data/lib/graphql/dashboard/views/graphql/dashboard/operation_store/operations/index.html.erb +81 -0
- data/lib/graphql/dashboard/views/graphql/dashboard/operation_store/operations/show.html.erb +71 -0
- data/lib/graphql/dashboard/views/graphql/dashboard/subscriptions/subscriptions/show.html.erb +41 -0
- data/lib/graphql/dashboard/views/graphql/dashboard/subscriptions/topics/index.html.erb +55 -0
- data/lib/graphql/dashboard/views/graphql/dashboard/subscriptions/topics/show.html.erb +40 -0
- data/lib/graphql/dashboard/views/layouts/graphql/dashboard/application.html.erb +108 -0
- data/lib/graphql/dashboard.rb +96 -0
- data/lib/graphql/dataloader/active_record_association_source.rb +84 -0
- data/lib/graphql/dataloader/active_record_source.rb +47 -0
- data/lib/graphql/dataloader/async_dataloader.rb +112 -0
- data/lib/graphql/dataloader/null_dataloader.rb +55 -10
- data/lib/graphql/dataloader/request.rb +5 -0
- data/lib/graphql/dataloader/source.rb +35 -12
- data/lib/graphql/dataloader.rb +224 -149
- data/lib/graphql/date_encoding_error.rb +1 -1
- data/lib/graphql/dig.rb +2 -1
- data/lib/graphql/duration_encoding_error.rb +16 -0
- data/lib/graphql/execution/interpreter/argument_value.rb +5 -1
- data/lib/graphql/execution/interpreter/arguments_cache.rb +5 -10
- data/lib/graphql/execution/interpreter/resolve.rb +23 -25
- data/lib/graphql/execution/interpreter/runtime/graphql_result.rb +228 -0
- data/lib/graphql/execution/interpreter/runtime.rb +363 -434
- data/lib/graphql/execution/interpreter.rb +91 -164
- data/lib/graphql/execution/lookahead.rb +105 -31
- data/lib/graphql/execution/multiplex.rb +7 -6
- data/lib/graphql/execution/next/field_resolve_step.rb +711 -0
- data/lib/graphql/execution/next/load_argument_step.rb +60 -0
- data/lib/graphql/execution/next/prepare_object_step.rb +129 -0
- data/lib/graphql/execution/next/runner.rb +389 -0
- data/lib/graphql/execution/next/selections_step.rb +37 -0
- data/lib/graphql/execution/next.rb +70 -0
- data/lib/graphql/execution.rb +1 -0
- data/lib/graphql/execution_error.rb +13 -10
- data/lib/graphql/introspection/directive_location_enum.rb +1 -1
- data/lib/graphql/introspection/directive_type.rb +7 -3
- data/lib/graphql/introspection/dynamic_fields.rb +5 -1
- data/lib/graphql/introspection/entry_points.rb +20 -6
- data/lib/graphql/introspection/enum_value_type.rb +5 -5
- data/lib/graphql/introspection/field_type.rb +13 -5
- data/lib/graphql/introspection/input_value_type.rb +21 -13
- data/lib/graphql/introspection/schema_type.rb +8 -11
- data/lib/graphql/introspection/type_type.rb +64 -28
- data/lib/graphql/invalid_name_error.rb +1 -1
- data/lib/graphql/invalid_null_error.rb +26 -17
- data/lib/graphql/language/block_string.rb +34 -18
- data/lib/graphql/language/cache.rb +13 -0
- data/lib/graphql/language/comment.rb +18 -0
- data/lib/graphql/language/definition_slice.rb +1 -1
- data/lib/graphql/language/document_from_schema_definition.rb +90 -61
- data/lib/graphql/language/lexer.rb +319 -193
- data/lib/graphql/language/nodes.rb +136 -77
- data/lib/graphql/language/parser.rb +807 -1985
- data/lib/graphql/language/printer.rb +324 -151
- data/lib/graphql/language/sanitized_printer.rb +21 -23
- data/lib/graphql/language/static_visitor.rb +171 -0
- data/lib/graphql/language/visitor.rb +23 -83
- data/lib/graphql/language.rb +71 -1
- data/lib/graphql/load_application_object_failed_error.rb +5 -1
- data/lib/graphql/pagination/array_connection.rb +6 -6
- data/lib/graphql/pagination/connection.rb +30 -1
- data/lib/graphql/pagination/connections.rb +32 -0
- data/lib/graphql/pagination/mongoid_relation_connection.rb +1 -2
- data/lib/graphql/query/context/scoped_context.rb +101 -0
- data/lib/graphql/query/context.rb +82 -144
- data/lib/graphql/query/null_context.rb +15 -18
- data/lib/graphql/query/partial.rb +179 -0
- data/lib/graphql/query/validation_pipeline.rb +4 -4
- data/lib/graphql/query/variable_validation_error.rb +1 -1
- data/lib/graphql/query/variables.rb +3 -3
- data/lib/graphql/query.rb +126 -81
- data/lib/graphql/railtie.rb +16 -6
- data/lib/graphql/rake_task.rb +3 -12
- data/lib/graphql/rubocop/graphql/base_cop.rb +1 -1
- data/lib/graphql/rubocop/graphql/field_type_in_block.rb +144 -0
- data/lib/graphql/rubocop/graphql/root_types_in_block.rb +38 -0
- data/lib/graphql/rubocop.rb +2 -0
- data/lib/graphql/schema/addition.rb +26 -13
- data/lib/graphql/schema/always_visible.rb +7 -2
- data/lib/graphql/schema/argument.rb +75 -9
- data/lib/graphql/schema/base_64_encoder.rb +3 -5
- data/lib/graphql/schema/build_from_definition.rb +123 -60
- data/lib/graphql/schema/directive/flagged.rb +4 -2
- data/lib/graphql/schema/directive/one_of.rb +12 -0
- data/lib/graphql/schema/directive/specified_by.rb +14 -0
- data/lib/graphql/schema/directive.rb +54 -2
- data/lib/graphql/schema/enum.rb +110 -27
- data/lib/graphql/schema/enum_value.rb +10 -2
- data/lib/graphql/schema/field/connection_extension.rb +15 -49
- data/lib/graphql/schema/field/scope_extension.rb +23 -7
- data/lib/graphql/schema/field.rb +245 -118
- data/lib/graphql/schema/field_extension.rb +34 -1
- data/lib/graphql/schema/has_single_input_argument.rb +160 -0
- data/lib/graphql/schema/input_object.rb +116 -60
- data/lib/graphql/schema/interface.rb +34 -16
- data/lib/graphql/schema/introspection_system.rb +8 -17
- data/lib/graphql/schema/late_bound_type.rb +4 -0
- data/lib/graphql/schema/list.rb +3 -3
- data/lib/graphql/schema/loader.rb +3 -4
- data/lib/graphql/schema/member/base_dsl_methods.rb +18 -2
- data/lib/graphql/schema/member/has_arguments.rb +132 -100
- data/lib/graphql/schema/member/has_authorization.rb +35 -0
- data/lib/graphql/schema/member/has_dataloader.rb +99 -0
- data/lib/graphql/schema/member/has_deprecation_reason.rb +15 -0
- data/lib/graphql/schema/member/has_directives.rb +4 -4
- data/lib/graphql/schema/member/has_fields.rb +115 -15
- data/lib/graphql/schema/member/has_interfaces.rb +26 -12
- data/lib/graphql/schema/member/has_unresolved_type_error.rb +5 -1
- data/lib/graphql/schema/member/has_validators.rb +1 -1
- data/lib/graphql/schema/member/relay_shortcuts.rb +1 -1
- data/lib/graphql/schema/member/scoped.rb +19 -0
- data/lib/graphql/schema/member/type_system_helpers.rb +17 -4
- data/lib/graphql/schema/member/validates_input.rb +3 -3
- data/lib/graphql/schema/member.rb +6 -0
- data/lib/graphql/schema/mutation.rb +7 -0
- data/lib/graphql/schema/object.rb +34 -8
- data/lib/graphql/schema/printer.rb +9 -7
- data/lib/graphql/schema/ractor_shareable.rb +79 -0
- data/lib/graphql/schema/relay_classic_mutation.rb +6 -129
- data/lib/graphql/schema/resolver.rb +90 -32
- data/lib/graphql/schema/scalar.rb +4 -9
- data/lib/graphql/schema/subscription.rb +63 -10
- data/lib/graphql/schema/timeout.rb +19 -2
- data/lib/graphql/schema/type_expression.rb +2 -2
- data/lib/graphql/schema/union.rb +2 -2
- data/lib/graphql/schema/unique_within_type.rb +1 -1
- data/lib/graphql/schema/validator/all_validator.rb +62 -0
- data/lib/graphql/schema/validator/required_validator.rb +92 -11
- data/lib/graphql/schema/validator.rb +3 -1
- data/lib/graphql/schema/visibility/migration.rb +188 -0
- data/lib/graphql/schema/visibility/profile.rb +445 -0
- data/lib/graphql/schema/visibility/visit.rb +190 -0
- data/lib/graphql/schema/visibility.rb +311 -0
- data/lib/graphql/schema/warden.rb +275 -103
- data/lib/graphql/schema.rb +950 -210
- data/lib/graphql/static_validation/all_rules.rb +3 -3
- data/lib/graphql/static_validation/base_visitor.rb +7 -6
- data/lib/graphql/static_validation/literal_validator.rb +6 -7
- data/lib/graphql/static_validation/rules/argument_literals_are_compatible.rb +1 -1
- data/lib/graphql/static_validation/rules/argument_names_are_unique.rb +1 -1
- data/lib/graphql/static_validation/rules/arguments_are_defined.rb +3 -2
- data/lib/graphql/static_validation/rules/directives_are_defined.rb +3 -3
- data/lib/graphql/static_validation/rules/directives_are_in_valid_locations.rb +2 -0
- data/lib/graphql/static_validation/rules/fields_are_defined_on_type.rb +12 -2
- data/lib/graphql/static_validation/rules/fields_have_appropriate_selections.rb +47 -13
- data/lib/graphql/static_validation/rules/fields_will_merge.rb +88 -25
- data/lib/graphql/static_validation/rules/fields_will_merge_error.rb +10 -2
- data/lib/graphql/static_validation/rules/fragment_spreads_are_possible.rb +3 -3
- data/lib/graphql/static_validation/rules/fragment_types_exist.rb +12 -2
- data/lib/graphql/static_validation/rules/fragments_are_on_composite_types.rb +1 -1
- data/lib/graphql/static_validation/rules/mutation_root_exists.rb +1 -1
- data/lib/graphql/static_validation/rules/no_definitions_are_present.rb +1 -1
- data/lib/graphql/static_validation/rules/not_single_subscription_error.rb +25 -0
- data/lib/graphql/static_validation/rules/query_root_exists.rb +1 -1
- data/lib/graphql/static_validation/rules/required_arguments_are_present.rb +5 -5
- data/lib/graphql/static_validation/rules/required_input_object_attributes_are_present.rb +5 -5
- data/lib/graphql/static_validation/rules/subscription_root_exists_and_single_subscription_selection.rb +26 -0
- data/lib/graphql/static_validation/rules/unique_directives_per_location.rb +7 -3
- data/lib/graphql/static_validation/rules/variable_default_values_are_correctly_typed.rb +18 -27
- data/lib/graphql/static_validation/rules/variable_names_are_unique.rb +1 -1
- data/lib/graphql/static_validation/rules/variable_usages_are_allowed.rb +2 -2
- data/lib/graphql/static_validation/rules/variables_are_input_types.rb +11 -2
- data/lib/graphql/static_validation/validation_context.rb +21 -5
- data/lib/graphql/static_validation/validator.rb +9 -1
- data/lib/graphql/static_validation.rb +0 -1
- data/lib/graphql/subscriptions/action_cable_subscriptions.rb +8 -5
- data/lib/graphql/subscriptions/broadcast_analyzer.rb +11 -5
- data/lib/graphql/subscriptions/default_subscription_resolve_extension.rb +12 -10
- data/lib/graphql/subscriptions/event.rb +21 -4
- data/lib/graphql/subscriptions/serialize.rb +3 -1
- data/lib/graphql/subscriptions.rb +21 -17
- data/lib/graphql/testing/helpers.rb +161 -0
- data/lib/graphql/testing/mock_action_cable.rb +111 -0
- data/lib/graphql/testing.rb +3 -0
- data/lib/graphql/tracing/active_support_notifications_trace.rb +14 -3
- data/lib/graphql/tracing/active_support_notifications_tracing.rb +1 -1
- data/lib/graphql/tracing/appoptics_trace.rb +7 -3
- data/lib/graphql/tracing/appoptics_tracing.rb +9 -2
- data/lib/graphql/tracing/appsignal_trace.rb +32 -59
- data/lib/graphql/tracing/appsignal_tracing.rb +2 -0
- data/lib/graphql/tracing/call_legacy_tracers.rb +66 -0
- data/lib/graphql/tracing/data_dog_trace.rb +46 -162
- data/lib/graphql/tracing/data_dog_tracing.rb +2 -0
- data/lib/graphql/tracing/detailed_trace/active_record_backend.rb +74 -0
- data/lib/graphql/tracing/detailed_trace/memory_backend.rb +60 -0
- data/lib/graphql/tracing/detailed_trace/redis_backend.rb +72 -0
- data/lib/graphql/tracing/detailed_trace.rb +156 -0
- data/lib/graphql/tracing/legacy_hooks_trace.rb +75 -0
- data/lib/graphql/tracing/legacy_trace.rb +4 -61
- data/lib/graphql/tracing/monitor_trace.rb +283 -0
- data/lib/graphql/tracing/new_relic_trace.rb +47 -54
- data/lib/graphql/tracing/new_relic_tracing.rb +2 -0
- data/lib/graphql/tracing/notifications_trace.rb +183 -37
- data/lib/graphql/tracing/notifications_tracing.rb +2 -0
- data/lib/graphql/tracing/null_trace.rb +9 -0
- data/lib/graphql/tracing/perfetto_trace/trace.proto +141 -0
- data/lib/graphql/tracing/perfetto_trace/trace_pb.rb +33 -0
- data/lib/graphql/tracing/perfetto_trace.rb +864 -0
- data/lib/graphql/tracing/platform_tracing.rb +3 -1
- data/lib/graphql/tracing/{prometheus_tracing → prometheus_trace}/graphql_collector.rb +5 -1
- data/lib/graphql/tracing/prometheus_trace.rb +73 -73
- data/lib/graphql/tracing/prometheus_tracing.rb +2 -0
- data/lib/graphql/tracing/scout_trace.rb +32 -58
- data/lib/graphql/tracing/scout_tracing.rb +2 -0
- data/lib/graphql/tracing/sentry_trace.rb +82 -0
- data/lib/graphql/tracing/statsd_trace.rb +33 -45
- data/lib/graphql/tracing/statsd_tracing.rb +2 -0
- data/lib/graphql/tracing/trace.rb +112 -1
- data/lib/graphql/tracing.rb +31 -28
- data/lib/graphql/type_kinds.rb +2 -1
- data/lib/graphql/types/iso_8601_duration.rb +77 -0
- data/lib/graphql/types/relay/connection_behaviors.rb +44 -2
- data/lib/graphql/types/relay/edge_behaviors.rb +18 -0
- data/lib/graphql/types/relay/has_node_field.rb +13 -8
- data/lib/graphql/types/relay/has_nodes_field.rb +13 -8
- data/lib/graphql/types/relay/node_behaviors.rb +13 -2
- data/lib/graphql/types/relay/page_info_behaviors.rb +4 -0
- data/lib/graphql/types.rb +18 -10
- data/lib/graphql/unauthorized_enum_value_error.rb +13 -0
- data/lib/graphql/unauthorized_error.rb +5 -1
- data/lib/graphql/version.rb +1 -1
- data/lib/graphql.rb +71 -54
- data/readme.md +12 -2
- metadata +233 -37
- data/lib/graphql/analysis/ast/analyzer.rb +0 -84
- data/lib/graphql/analysis/ast/field_usage.rb +0 -57
- data/lib/graphql/analysis/ast/max_query_complexity.rb +0 -22
- data/lib/graphql/analysis/ast/max_query_depth.rb +0 -22
- data/lib/graphql/analysis/ast/query_complexity.rb +0 -230
- data/lib/graphql/analysis/ast/query_depth.rb +0 -55
- data/lib/graphql/analysis/ast/visitor.rb +0 -276
- data/lib/graphql/analysis/ast.rb +0 -81
- data/lib/graphql/backtrace/inspect_result.rb +0 -50
- data/lib/graphql/backtrace/trace.rb +0 -96
- data/lib/graphql/backtrace/tracer.rb +0 -80
- data/lib/graphql/deprecation.rb +0 -9
- data/lib/graphql/filter.rb +0 -59
- data/lib/graphql/language/parser.y +0 -560
- data/lib/graphql/language/token.rb +0 -34
- data/lib/graphql/schema/base_64_bp.rb +0 -26
- data/lib/graphql/schema/invalid_type_error.rb +0 -7
- data/lib/graphql/schema/null_mask.rb +0 -11
- data/lib/graphql/static_validation/rules/subscription_root_exists.rb +0 -17
- data/lib/graphql/static_validation/type_stack.rb +0 -216
- data/lib/graphql/subscriptions/instrumentation.rb +0 -28
data/lib/graphql/tracing.rb
CHANGED
|
@@ -1,36 +1,39 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
-
require "graphql/tracing/trace"
|
|
3
|
-
require "graphql/tracing/legacy_trace"
|
|
4
2
|
|
|
5
|
-
# Legacy tracing:
|
|
6
|
-
require "graphql/tracing/active_support_notifications_tracing"
|
|
7
|
-
require "graphql/tracing/platform_tracing"
|
|
8
|
-
require "graphql/tracing/appoptics_tracing"
|
|
9
|
-
require "graphql/tracing/appsignal_tracing"
|
|
10
|
-
require "graphql/tracing/data_dog_tracing"
|
|
11
|
-
require "graphql/tracing/new_relic_tracing"
|
|
12
|
-
require "graphql/tracing/scout_tracing"
|
|
13
|
-
require "graphql/tracing/statsd_tracing"
|
|
14
|
-
require "graphql/tracing/prometheus_tracing"
|
|
15
|
-
|
|
16
|
-
# New Tracing:
|
|
17
|
-
require "graphql/tracing/active_support_notifications_trace"
|
|
18
|
-
require "graphql/tracing/platform_trace"
|
|
19
|
-
require "graphql/tracing/appoptics_trace"
|
|
20
|
-
require "graphql/tracing/appsignal_trace"
|
|
21
|
-
require "graphql/tracing/data_dog_trace"
|
|
22
|
-
require "graphql/tracing/new_relic_trace"
|
|
23
|
-
require "graphql/tracing/notifications_trace"
|
|
24
|
-
require "graphql/tracing/scout_trace"
|
|
25
|
-
require "graphql/tracing/statsd_trace"
|
|
26
|
-
require "graphql/tracing/prometheus_trace"
|
|
27
|
-
if defined?(PrometheusExporter::Server)
|
|
28
|
-
require "graphql/tracing/prometheus_tracing/graphql_collector"
|
|
29
|
-
end
|
|
30
3
|
|
|
31
4
|
module GraphQL
|
|
32
5
|
module Tracing
|
|
33
|
-
|
|
6
|
+
autoload :Trace, "graphql/tracing/trace"
|
|
7
|
+
autoload :CallLegacyTracers, "graphql/tracing/call_legacy_tracers"
|
|
8
|
+
autoload :LegacyTrace, "graphql/tracing/legacy_trace"
|
|
9
|
+
autoload :LegacyHooksTrace, "graphql/tracing/legacy_hooks_trace"
|
|
10
|
+
autoload :NullTrace, "graphql/tracing/null_trace"
|
|
11
|
+
|
|
12
|
+
autoload :ActiveSupportNotificationsTracing, "graphql/tracing/active_support_notifications_tracing"
|
|
13
|
+
autoload :PlatformTracing, "graphql/tracing/platform_tracing"
|
|
14
|
+
autoload :AppOpticsTracing, "graphql/tracing/appoptics_tracing"
|
|
15
|
+
autoload :AppsignalTracing, "graphql/tracing/appsignal_tracing"
|
|
16
|
+
autoload :DataDogTracing, "graphql/tracing/data_dog_tracing"
|
|
17
|
+
autoload :NewRelicTracing, "graphql/tracing/new_relic_tracing"
|
|
18
|
+
autoload :NotificationsTracing, "graphql/tracing/notifications_tracing"
|
|
19
|
+
autoload :ScoutTracing, "graphql/tracing/scout_tracing"
|
|
20
|
+
autoload :StatsdTracing, "graphql/tracing/statsd_tracing"
|
|
21
|
+
autoload :PrometheusTracing, "graphql/tracing/prometheus_tracing"
|
|
22
|
+
|
|
23
|
+
autoload :ActiveSupportNotificationsTrace, "graphql/tracing/active_support_notifications_trace"
|
|
24
|
+
autoload :PlatformTrace, "graphql/tracing/platform_trace"
|
|
25
|
+
autoload :AppOpticsTrace, "graphql/tracing/appoptics_trace"
|
|
26
|
+
autoload :AppsignalTrace, "graphql/tracing/appsignal_trace"
|
|
27
|
+
autoload :DataDogTrace, "graphql/tracing/data_dog_trace"
|
|
28
|
+
autoload :MonitorTrace, "graphql/tracing/monitor_trace"
|
|
29
|
+
autoload :NewRelicTrace, "graphql/tracing/new_relic_trace"
|
|
30
|
+
autoload :NotificationsTrace, "graphql/tracing/notifications_trace"
|
|
31
|
+
autoload :SentryTrace, "graphql/tracing/sentry_trace"
|
|
32
|
+
autoload :ScoutTrace, "graphql/tracing/scout_trace"
|
|
33
|
+
autoload :StatsdTrace, "graphql/tracing/statsd_trace"
|
|
34
|
+
autoload :PrometheusTrace, "graphql/tracing/prometheus_trace"
|
|
35
|
+
autoload :PerfettoTrace, "graphql/tracing/perfetto_trace"
|
|
36
|
+
autoload :DetailedTrace, "graphql/tracing/detailed_trace"
|
|
34
37
|
|
|
35
38
|
# Objects may include traceable to gain a `.trace(...)` method.
|
|
36
39
|
# The object must have a `@tracers` ivar of type `Array<<#trace(k, d, &b)>>`.
|
data/lib/graphql/type_kinds.rb
CHANGED
|
@@ -14,9 +14,10 @@ module GraphQL
|
|
|
14
14
|
@leaf = leaf
|
|
15
15
|
@composite = fields? || abstract?
|
|
16
16
|
@description = description
|
|
17
|
+
freeze
|
|
17
18
|
end
|
|
18
19
|
|
|
19
|
-
# Does this TypeKind have multiple possible
|
|
20
|
+
# Does this TypeKind have multiple possible implementers?
|
|
20
21
|
# @deprecated Use `abstract?` instead of `resolves?`.
|
|
21
22
|
def resolves?; @abstract; end
|
|
22
23
|
# Is this TypeKind abstract?
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
module GraphQL
|
|
3
|
+
module Types
|
|
4
|
+
# This scalar takes `Duration`s and transmits them as strings,
|
|
5
|
+
# using ISO 8601 format. ActiveSupport >= 5.0 must be loaded to use
|
|
6
|
+
# this scalar.
|
|
7
|
+
#
|
|
8
|
+
# Use it for fields or arguments as follows:
|
|
9
|
+
#
|
|
10
|
+
# field :age, GraphQL::Types::ISO8601Duration, null: false
|
|
11
|
+
#
|
|
12
|
+
# argument :interval, GraphQL::Types::ISO8601Duration, null: false
|
|
13
|
+
#
|
|
14
|
+
# Alternatively, use this built-in scalar as inspiration for your
|
|
15
|
+
# own Duration type.
|
|
16
|
+
class ISO8601Duration < GraphQL::Schema::Scalar
|
|
17
|
+
description "An ISO 8601-encoded duration"
|
|
18
|
+
|
|
19
|
+
# @return [Integer, nil]
|
|
20
|
+
def self.seconds_precision
|
|
21
|
+
# ActiveSupport::Duration precision defaults to whatever input was given
|
|
22
|
+
@seconds_precision
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# @param [Integer, nil] value
|
|
26
|
+
def self.seconds_precision=(value)
|
|
27
|
+
@seconds_precision = value
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# @param value [ActiveSupport::Duration, String]
|
|
31
|
+
# @return [String]
|
|
32
|
+
# @raise [GraphQL::Error] if ActiveSupport::Duration is not defined or if an incompatible object is passed
|
|
33
|
+
def self.coerce_result(value, _ctx)
|
|
34
|
+
unless defined?(ActiveSupport::Duration)
|
|
35
|
+
raise GraphQL::Error, "ActiveSupport >= 5.0 must be loaded to use the built-in ISO8601Duration type."
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
begin
|
|
39
|
+
case value
|
|
40
|
+
when ActiveSupport::Duration
|
|
41
|
+
value.iso8601(precision: seconds_precision)
|
|
42
|
+
when ::String
|
|
43
|
+
ActiveSupport::Duration.parse(value).iso8601(precision: seconds_precision)
|
|
44
|
+
else
|
|
45
|
+
# Try calling as ActiveSupport::Duration compatible as a fallback
|
|
46
|
+
value.iso8601(precision: seconds_precision)
|
|
47
|
+
end
|
|
48
|
+
rescue StandardError => error
|
|
49
|
+
raise GraphQL::Error, "An incompatible object (#{value.class}) was given to #{self}. Make sure that only ActiveSupport::Durations and well-formatted Strings are used with this type. (#{error.message})"
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# @param value [String, ActiveSupport::Duration]
|
|
54
|
+
# @return [ActiveSupport::Duration, nil]
|
|
55
|
+
# @raise [GraphQL::Error] if ActiveSupport::Duration is not defined
|
|
56
|
+
# @raise [GraphQL::DurationEncodingError] if duration cannot be parsed
|
|
57
|
+
def self.coerce_input(value, ctx)
|
|
58
|
+
unless defined?(ActiveSupport::Duration)
|
|
59
|
+
raise GraphQL::Error, "ActiveSupport >= 5.0 must be loaded to use the built-in ISO8601Duration type."
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
begin
|
|
63
|
+
if value.is_a?(ActiveSupport::Duration)
|
|
64
|
+
value
|
|
65
|
+
elsif value.nil?
|
|
66
|
+
nil
|
|
67
|
+
else
|
|
68
|
+
ActiveSupport::Duration.parse(value)
|
|
69
|
+
end
|
|
70
|
+
rescue ArgumentError, TypeError
|
|
71
|
+
err = GraphQL::DurationEncodingError.new(value)
|
|
72
|
+
ctx.schema.type_error(err, ctx)
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
end
|
|
@@ -18,6 +18,7 @@ module GraphQL
|
|
|
18
18
|
self.node_type = nil
|
|
19
19
|
self.edge_class = nil
|
|
20
20
|
}
|
|
21
|
+
child_class.default_broadcastable(nil)
|
|
21
22
|
add_page_info_field(child_class)
|
|
22
23
|
end
|
|
23
24
|
|
|
@@ -31,12 +32,21 @@ module GraphQL
|
|
|
31
32
|
child_class.edge_type = nil
|
|
32
33
|
child_class.node_type = nil
|
|
33
34
|
child_class.edge_class = nil
|
|
35
|
+
child_class.default_broadcastable(default_broadcastable?)
|
|
34
36
|
end
|
|
35
37
|
|
|
36
38
|
def default_relay?
|
|
37
39
|
true
|
|
38
40
|
end
|
|
39
41
|
|
|
42
|
+
def default_broadcastable?
|
|
43
|
+
@default_broadcastable
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def default_broadcastable(new_value)
|
|
47
|
+
@default_broadcastable = new_value
|
|
48
|
+
end
|
|
49
|
+
|
|
40
50
|
# @return [Class]
|
|
41
51
|
attr_reader :node_type
|
|
42
52
|
|
|
@@ -67,9 +77,8 @@ module GraphQL
|
|
|
67
77
|
type: [edge_type_class, null: edge_nullable],
|
|
68
78
|
null: edges_nullable,
|
|
69
79
|
description: "A list of edges.",
|
|
80
|
+
scope: false, # Assume that the connection was already scoped.
|
|
70
81
|
connection: false,
|
|
71
|
-
# Assume that the connection was scoped before this step:
|
|
72
|
-
scope: false,
|
|
73
82
|
}
|
|
74
83
|
|
|
75
84
|
if field_options
|
|
@@ -88,6 +97,19 @@ module GraphQL
|
|
|
88
97
|
node_type.scope_items(items, context)
|
|
89
98
|
end
|
|
90
99
|
|
|
100
|
+
# The connection will skip auth on its nodes if the node_type is configured for that
|
|
101
|
+
def reauthorize_scoped_objects(new_value = nil)
|
|
102
|
+
if new_value.nil?
|
|
103
|
+
if @reauthorize_scoped_objects != nil
|
|
104
|
+
@reauthorize_scoped_objects
|
|
105
|
+
else
|
|
106
|
+
node_type.reauthorize_scoped_objects
|
|
107
|
+
end
|
|
108
|
+
else
|
|
109
|
+
@reauthorize_scoped_objects = new_value
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
|
|
91
113
|
# Add the shortcut `nodes` field to this connection and its subclasses
|
|
92
114
|
def nodes_field(node_nullable: self.node_nullable, field_options: nil)
|
|
93
115
|
define_nodes_field(node_nullable, field_options: field_options)
|
|
@@ -170,6 +192,26 @@ module GraphQL
|
|
|
170
192
|
obj_type.field :page_info, GraphQL::Types::Relay::PageInfo, null: false, description: "Information to aid in pagination."
|
|
171
193
|
end
|
|
172
194
|
end
|
|
195
|
+
|
|
196
|
+
def edges
|
|
197
|
+
# Assume that whatever authorization needed to happen
|
|
198
|
+
# already happened at the connection level.
|
|
199
|
+
if (current_runtime_state = Fiber[:__graphql_runtime_info])
|
|
200
|
+
query_runtime_state = current_runtime_state[context.query]
|
|
201
|
+
query_runtime_state.was_authorized_by_scope_items = @object.was_authorized_by_scope_items?
|
|
202
|
+
end
|
|
203
|
+
@object.edges
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
def nodes
|
|
207
|
+
# Assume that whatever authorization needed to happen
|
|
208
|
+
# already happened at the connection level.
|
|
209
|
+
if (current_runtime_state = Fiber[:__graphql_runtime_info])
|
|
210
|
+
query_runtime_state = current_runtime_state[context.query]
|
|
211
|
+
query_runtime_state.was_authorized_by_scope_items = @object.was_authorized_by_scope_items?
|
|
212
|
+
end
|
|
213
|
+
@object.nodes
|
|
214
|
+
end
|
|
173
215
|
end
|
|
174
216
|
end
|
|
175
217
|
end
|
|
@@ -10,6 +10,15 @@ module GraphQL
|
|
|
10
10
|
child_class.extend(ClassMethods)
|
|
11
11
|
child_class.class_exec { self.node_type = nil }
|
|
12
12
|
child_class.node_nullable(true)
|
|
13
|
+
child_class.default_broadcastable(nil)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def node
|
|
17
|
+
if (current_runtime_state = Fiber[:__graphql_runtime_info])
|
|
18
|
+
query_runtime_state = current_runtime_state[context.query]
|
|
19
|
+
query_runtime_state.was_authorized_by_scope_items = @object.was_authorized_by_scope_items?
|
|
20
|
+
end
|
|
21
|
+
@object.node
|
|
13
22
|
end
|
|
14
23
|
|
|
15
24
|
module ClassMethods
|
|
@@ -17,12 +26,21 @@ module GraphQL
|
|
|
17
26
|
super
|
|
18
27
|
child_class.node_type = nil
|
|
19
28
|
child_class.node_nullable = nil
|
|
29
|
+
child_class.default_broadcastable(default_broadcastable?)
|
|
20
30
|
end
|
|
21
31
|
|
|
22
32
|
def default_relay?
|
|
23
33
|
true
|
|
24
34
|
end
|
|
25
35
|
|
|
36
|
+
def default_broadcastable?
|
|
37
|
+
@default_broadcastable
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def default_broadcastable(new_value)
|
|
41
|
+
@default_broadcastable = new_value
|
|
42
|
+
end
|
|
43
|
+
|
|
26
44
|
# Get or set the Object type that this edge wraps.
|
|
27
45
|
#
|
|
28
46
|
# @param node_type [Class] A `Schema::Object` subclass
|
|
@@ -7,6 +7,17 @@ module GraphQL
|
|
|
7
7
|
module HasNodeField
|
|
8
8
|
def self.included(child_class)
|
|
9
9
|
child_class.field(**field_options, &field_block)
|
|
10
|
+
child_class.extend(ExecutionMethods)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
module ExecutionMethods
|
|
14
|
+
def get_relay_node(context, id:)
|
|
15
|
+
context.schema.object_from_id(id, context)
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def get_relay_node(id:)
|
|
20
|
+
self.class.get_relay_node(context, id: id)
|
|
10
21
|
end
|
|
11
22
|
|
|
12
23
|
class << self
|
|
@@ -17,6 +28,8 @@ module GraphQL
|
|
|
17
28
|
null: true,
|
|
18
29
|
description: "Fetches an object given its ID.",
|
|
19
30
|
relay_node_field: true,
|
|
31
|
+
resolver_method: :get_relay_node,
|
|
32
|
+
resolve_static: :get_relay_node,
|
|
20
33
|
}
|
|
21
34
|
end
|
|
22
35
|
|
|
@@ -24,14 +37,6 @@ module GraphQL
|
|
|
24
37
|
Proc.new {
|
|
25
38
|
argument :id, "ID!",
|
|
26
39
|
description: "ID of the object."
|
|
27
|
-
|
|
28
|
-
def resolve(obj, args, ctx)
|
|
29
|
-
ctx.schema.object_from_id(args[:id], ctx)
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def resolve_field(obj, args, ctx)
|
|
33
|
-
resolve(obj, args, ctx)
|
|
34
|
-
end
|
|
35
40
|
}
|
|
36
41
|
end
|
|
37
42
|
end
|
|
@@ -7,6 +7,17 @@ module GraphQL
|
|
|
7
7
|
module HasNodesField
|
|
8
8
|
def self.included(child_class)
|
|
9
9
|
child_class.field(**field_options, &field_block)
|
|
10
|
+
child_class.extend(ExecutionMethods)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
module ExecutionMethods
|
|
14
|
+
def get_relay_nodes(context, ids:)
|
|
15
|
+
ids.map { |id| context.schema.object_from_id(id, context) }
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def get_relay_nodes(ids:)
|
|
20
|
+
self.class.get_relay_nodes(context, ids: ids)
|
|
10
21
|
end
|
|
11
22
|
|
|
12
23
|
class << self
|
|
@@ -17,6 +28,8 @@ module GraphQL
|
|
|
17
28
|
null: false,
|
|
18
29
|
description: "Fetches a list of objects given a list of IDs.",
|
|
19
30
|
relay_nodes_field: true,
|
|
31
|
+
resolver_method: :get_relay_nodes,
|
|
32
|
+
resolve_static: :get_relay_nodes
|
|
20
33
|
}
|
|
21
34
|
end
|
|
22
35
|
|
|
@@ -24,14 +37,6 @@ module GraphQL
|
|
|
24
37
|
Proc.new {
|
|
25
38
|
argument :ids, "[ID!]!",
|
|
26
39
|
description: "IDs of the objects."
|
|
27
|
-
|
|
28
|
-
def resolve(obj, args, ctx)
|
|
29
|
-
args[:ids].map { |id| ctx.schema.object_from_id(id, ctx) }
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def resolve_field(obj, args, ctx)
|
|
33
|
-
resolve(obj, args, ctx)
|
|
34
|
-
end
|
|
35
40
|
}
|
|
36
41
|
end
|
|
37
42
|
end
|
|
@@ -6,12 +6,13 @@ module GraphQL
|
|
|
6
6
|
module NodeBehaviors
|
|
7
7
|
def self.included(child_module)
|
|
8
8
|
child_module.extend(ClassMethods)
|
|
9
|
+
child_module.extend(ExecutionMethods)
|
|
9
10
|
child_module.description("An object with an ID.")
|
|
10
|
-
child_module.field(:id, ID, null: false, description: "ID of the object.", resolver_method: :default_global_id)
|
|
11
|
+
child_module.field(:id, ID, null: false, description: "ID of the object.", resolver_method: :default_global_id, resolve_each: :default_global_id)
|
|
11
12
|
end
|
|
12
13
|
|
|
13
14
|
def default_global_id
|
|
14
|
-
|
|
15
|
+
self.class.default_global_id(object, context)
|
|
15
16
|
end
|
|
16
17
|
|
|
17
18
|
module ClassMethods
|
|
@@ -19,6 +20,16 @@ module GraphQL
|
|
|
19
20
|
true
|
|
20
21
|
end
|
|
21
22
|
end
|
|
23
|
+
|
|
24
|
+
module ExecutionMethods
|
|
25
|
+
def default_global_id(object, context)
|
|
26
|
+
context.schema.id_from_object(object, self, context)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def included(child_class)
|
|
30
|
+
child_class.extend(ExecutionMethods)
|
|
31
|
+
end
|
|
32
|
+
end
|
|
22
33
|
end
|
|
23
34
|
end
|
|
24
35
|
end
|
data/lib/graphql/types.rb
CHANGED
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
|
|
3
|
+
module GraphQL
|
|
4
|
+
module Types
|
|
5
|
+
extend Autoload
|
|
6
|
+
|
|
7
|
+
autoload :Boolean, "graphql/types/boolean"
|
|
8
|
+
autoload :BigInt, "graphql/types/big_int"
|
|
9
|
+
autoload :Float, "graphql/types/float"
|
|
10
|
+
autoload :ID, "graphql/types/id"
|
|
11
|
+
autoload :Int, "graphql/types/int"
|
|
12
|
+
autoload :JSON, "graphql/types/json"
|
|
13
|
+
autoload :String, "graphql/types/string"
|
|
14
|
+
autoload :ISO8601Date, "graphql/types/iso_8601_date"
|
|
15
|
+
autoload :ISO8601DateTime, "graphql/types/iso_8601_date_time"
|
|
16
|
+
autoload :ISO8601Duration, "graphql/types/iso_8601_duration"
|
|
17
|
+
autoload :Relay, "graphql/types/relay"
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
module GraphQL
|
|
3
|
+
class UnauthorizedEnumValueError < GraphQL::UnauthorizedError
|
|
4
|
+
# @return [GraphQL::Schema::EnumValue] The value whose `#authorized?` check returned false
|
|
5
|
+
attr_accessor :enum_value
|
|
6
|
+
|
|
7
|
+
def initialize(type:, context:, enum_value:)
|
|
8
|
+
@enum_value = enum_value
|
|
9
|
+
message ||= "#{enum_value.path} failed authorization"
|
|
10
|
+
super(message, object: enum_value.value, type: type, context: context)
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -4,7 +4,7 @@ module GraphQL
|
|
|
4
4
|
# It's passed to {Schema.unauthorized_object}.
|
|
5
5
|
#
|
|
6
6
|
# Alternatively, custom code in `authorized?` may raise this error. It will be routed the same way.
|
|
7
|
-
class UnauthorizedError < GraphQL::
|
|
7
|
+
class UnauthorizedError < GraphQL::RuntimeError
|
|
8
8
|
# @return [Object] the application object that failed the authorization check
|
|
9
9
|
attr_reader :object
|
|
10
10
|
|
|
@@ -19,11 +19,15 @@ module GraphQL
|
|
|
19
19
|
raise ArgumentError, "#{self.class.name} requires either a message or keywords"
|
|
20
20
|
end
|
|
21
21
|
|
|
22
|
+
@path = nil
|
|
22
23
|
@object = object
|
|
23
24
|
@type = type
|
|
24
25
|
@context = context
|
|
26
|
+
@ast_nodes = nil
|
|
25
27
|
message ||= "An instance of #{object.class} failed #{type.graphql_name}'s authorization check"
|
|
26
28
|
super(message)
|
|
27
29
|
end
|
|
30
|
+
|
|
31
|
+
attr_accessor :path, :ast_nodes
|
|
28
32
|
end
|
|
29
33
|
end
|
data/lib/graphql/version.rb
CHANGED
data/lib/graphql.rb
CHANGED
|
@@ -4,19 +4,26 @@ require "json"
|
|
|
4
4
|
require "set"
|
|
5
5
|
require "singleton"
|
|
6
6
|
require "forwardable"
|
|
7
|
+
require "fiber/storage" if RUBY_VERSION < "3.2.0"
|
|
8
|
+
require "graphql/autoload"
|
|
7
9
|
|
|
8
10
|
module GraphQL
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
extend Autoload
|
|
12
|
+
|
|
13
|
+
# Load all `autoload`-configured classes, and also eager-load dependents who have autoloads of their own.
|
|
14
|
+
def self.eager_load!
|
|
15
|
+
super
|
|
16
|
+
Query.eager_load!
|
|
17
|
+
Types.eager_load!
|
|
18
|
+
Schema.eager_load!
|
|
15
19
|
end
|
|
16
20
|
|
|
17
21
|
class Error < StandardError
|
|
18
22
|
end
|
|
19
23
|
|
|
24
|
+
class RuntimeError < Error
|
|
25
|
+
end
|
|
26
|
+
|
|
20
27
|
# This error is raised when GraphQL-Ruby encounters a situation
|
|
21
28
|
# that it *thought* would never happen. Please report this bug!
|
|
22
29
|
class InvariantError < Error
|
|
@@ -42,8 +49,8 @@ This is probably a bug in GraphQL-Ruby, please report this error on GitHub: http
|
|
|
42
49
|
# Turn a query string or schema definition into an AST
|
|
43
50
|
# @param graphql_string [String] a GraphQL query string or schema definition
|
|
44
51
|
# @return [GraphQL::Language::Nodes::Document]
|
|
45
|
-
def self.parse(graphql_string, trace: GraphQL::Tracing::NullTrace)
|
|
46
|
-
default_parser.parse(graphql_string, trace: trace)
|
|
52
|
+
def self.parse(graphql_string, trace: GraphQL::Tracing::NullTrace, filename: nil, max_tokens: nil)
|
|
53
|
+
default_parser.parse(graphql_string, trace: trace, filename: filename, max_tokens: max_tokens)
|
|
47
54
|
end
|
|
48
55
|
|
|
49
56
|
# Read the contents of `filename` and parse them as GraphQL
|
|
@@ -60,6 +67,7 @@ This is probably a bug in GraphQL-Ruby, please report this error on GitHub: http
|
|
|
60
67
|
end
|
|
61
68
|
|
|
62
69
|
def self.parse_with_racc(string, filename: nil, trace: GraphQL::Tracing::NullTrace)
|
|
70
|
+
warn "`GraphQL.parse_with_racc` is deprecated; GraphQL-Ruby no longer uses racc for parsing. Call `GraphQL.parse` or `GraphQL::Language::Parser.parse` instead."
|
|
63
71
|
GraphQL::Language::Parser.parse(string, filename: filename, trace: trace)
|
|
64
72
|
end
|
|
65
73
|
|
|
@@ -67,57 +75,66 @@ This is probably a bug in GraphQL-Ruby, please report this error on GitHub: http
|
|
|
67
75
|
GraphQL::Language::Lexer.tokenize(graphql_string)
|
|
68
76
|
end
|
|
69
77
|
|
|
70
|
-
NOT_CONFIGURED = Object.new
|
|
78
|
+
NOT_CONFIGURED = Object.new.freeze
|
|
71
79
|
private_constant :NOT_CONFIGURED
|
|
72
80
|
module EmptyObjects
|
|
73
81
|
EMPTY_HASH = {}.freeze
|
|
74
82
|
EMPTY_ARRAY = [].freeze
|
|
75
83
|
end
|
|
76
|
-
end
|
|
77
84
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
85
|
+
class << self
|
|
86
|
+
# If true, the parser should raise when an integer or float is followed immediately by an identifier (instead of a space or punctuation)
|
|
87
|
+
attr_accessor :reject_numbers_followed_by_names
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
self.reject_numbers_followed_by_names = false
|
|
91
|
+
|
|
92
|
+
autoload :ExecutionError, "graphql/execution_error"
|
|
93
|
+
autoload :RuntimeTypeError, "graphql/runtime_type_error"
|
|
94
|
+
autoload :UnresolvedTypeError, "graphql/unresolved_type_error"
|
|
95
|
+
autoload :InvalidNullError, "graphql/invalid_null_error"
|
|
96
|
+
autoload :AnalysisError, "graphql/analysis_error"
|
|
97
|
+
autoload :CoercionError, "graphql/coercion_error"
|
|
98
|
+
autoload :InvalidNameError, "graphql/invalid_name_error"
|
|
99
|
+
autoload :IntegerDecodingError, "graphql/integer_decoding_error"
|
|
100
|
+
autoload :IntegerEncodingError, "graphql/integer_encoding_error"
|
|
101
|
+
autoload :StringEncodingError, "graphql/string_encoding_error"
|
|
102
|
+
autoload :DateEncodingError, "graphql/date_encoding_error"
|
|
103
|
+
autoload :DurationEncodingError, "graphql/duration_encoding_error"
|
|
104
|
+
autoload :TypeKinds, "graphql/type_kinds"
|
|
105
|
+
autoload :NameValidator, "graphql/name_validator"
|
|
106
|
+
autoload :Language, "graphql/language"
|
|
107
|
+
|
|
108
|
+
autoload :Analysis, "graphql/analysis"
|
|
109
|
+
autoload :Tracing, "graphql/tracing"
|
|
110
|
+
autoload :Dig, "graphql/dig"
|
|
111
|
+
autoload :Execution, "graphql/execution"
|
|
112
|
+
autoload :Pagination, "graphql/pagination"
|
|
113
|
+
autoload :Schema, "graphql/schema"
|
|
114
|
+
autoload :Query, "graphql/query"
|
|
115
|
+
autoload :Dataloader, "graphql/dataloader"
|
|
116
|
+
autoload :Types, "graphql/types"
|
|
117
|
+
autoload :StaticValidation, "graphql/static_validation"
|
|
118
|
+
autoload :Execution, "graphql/execution"
|
|
119
|
+
autoload :Introspection, "graphql/introspection"
|
|
120
|
+
autoload :Relay, "graphql/relay"
|
|
121
|
+
autoload :Subscriptions, "graphql/subscriptions"
|
|
122
|
+
autoload :ParseError, "graphql/parse_error"
|
|
123
|
+
autoload :Backtrace, "graphql/backtrace"
|
|
124
|
+
|
|
125
|
+
autoload :UnauthorizedError, "graphql/unauthorized_error"
|
|
126
|
+
autoload :UnauthorizedEnumValueError, "graphql/unauthorized_enum_value_error"
|
|
127
|
+
autoload :UnauthorizedFieldError, "graphql/unauthorized_field_error"
|
|
128
|
+
autoload :LoadApplicationObjectFailedError, "graphql/load_application_object_failed_error"
|
|
129
|
+
autoload :Testing, "graphql/testing"
|
|
130
|
+
autoload :Current, "graphql/current"
|
|
131
|
+
if defined?(::Rails::Engine)
|
|
132
|
+
# This needs to be defined before Rails runs `add_routing_paths`,
|
|
133
|
+
# otherwise GraphQL::Dashboard's routes won't have been gathered for loading
|
|
134
|
+
# when that initializer runs.
|
|
135
|
+
require 'graphql/dashboard'
|
|
136
|
+
end
|
|
137
|
+
end
|
|
114
138
|
|
|
115
139
|
require "graphql/version"
|
|
116
|
-
require "graphql/
|
|
117
|
-
require "graphql/parse_error"
|
|
118
|
-
require "graphql/backtrace"
|
|
119
|
-
|
|
120
|
-
require "graphql/unauthorized_error"
|
|
121
|
-
require "graphql/unauthorized_field_error"
|
|
122
|
-
require "graphql/load_application_object_failed_error"
|
|
123
|
-
require "graphql/deprecation"
|
|
140
|
+
require "graphql/railtie" if defined? Rails::Railtie
|