graphql 1.10.14 → 1.11.4

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.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/lib/generators/graphql/core.rb +8 -0
  3. data/lib/generators/graphql/templates/base_argument.erb +2 -0
  4. data/lib/generators/graphql/templates/base_enum.erb +2 -0
  5. data/lib/generators/graphql/templates/base_field.erb +2 -0
  6. data/lib/generators/graphql/templates/base_input_object.erb +2 -0
  7. data/lib/generators/graphql/templates/base_interface.erb +2 -0
  8. data/lib/generators/graphql/templates/base_mutation.erb +2 -0
  9. data/lib/generators/graphql/templates/base_object.erb +2 -0
  10. data/lib/generators/graphql/templates/base_scalar.erb +2 -0
  11. data/lib/generators/graphql/templates/base_union.erb +2 -0
  12. data/lib/generators/graphql/templates/enum.erb +2 -0
  13. data/lib/generators/graphql/templates/graphql_controller.erb +13 -9
  14. data/lib/generators/graphql/templates/interface.erb +2 -0
  15. data/lib/generators/graphql/templates/loader.erb +2 -0
  16. data/lib/generators/graphql/templates/mutation.erb +2 -0
  17. data/lib/generators/graphql/templates/mutation_type.erb +2 -0
  18. data/lib/generators/graphql/templates/object.erb +2 -0
  19. data/lib/generators/graphql/templates/query_type.erb +2 -0
  20. data/lib/generators/graphql/templates/scalar.erb +2 -0
  21. data/lib/generators/graphql/templates/schema.erb +2 -0
  22. data/lib/generators/graphql/templates/union.erb +2 -0
  23. data/lib/graphql.rb +3 -3
  24. data/lib/graphql/execution/interpreter.rb +1 -1
  25. data/lib/graphql/execution/interpreter/runtime.rb +26 -26
  26. data/lib/graphql/execution/multiplex.rb +1 -2
  27. data/lib/graphql/introspection/schema_type.rb +3 -3
  28. data/lib/graphql/invalid_null_error.rb +18 -0
  29. data/lib/graphql/language/nodes.rb +1 -0
  30. data/lib/graphql/language/visitor.rb +2 -2
  31. data/lib/graphql/pagination/connection.rb +18 -13
  32. data/lib/graphql/pagination/connections.rb +17 -4
  33. data/lib/graphql/query.rb +1 -2
  34. data/lib/graphql/query/context.rb +20 -1
  35. data/lib/graphql/query/fingerprint.rb +2 -0
  36. data/lib/graphql/query/validation_pipeline.rb +3 -0
  37. data/lib/graphql/schema.rb +26 -16
  38. data/lib/graphql/schema/build_from_definition.rb +7 -12
  39. data/lib/graphql/schema/build_from_definition/resolve_map.rb +3 -1
  40. data/lib/graphql/schema/enum_value.rb +1 -0
  41. data/lib/graphql/schema/field.rb +63 -77
  42. data/lib/graphql/schema/field/connection_extension.rb +42 -32
  43. data/lib/graphql/schema/loader.rb +19 -1
  44. data/lib/graphql/schema/member/has_fields.rb +15 -5
  45. data/lib/graphql/schema/mutation.rb +4 -0
  46. data/lib/graphql/schema/object.rb +1 -1
  47. data/lib/graphql/schema/resolver.rb +20 -0
  48. data/lib/graphql/schema/resolver/has_payload_type.rb +2 -1
  49. data/lib/graphql/schema/subscription.rb +3 -13
  50. data/lib/graphql/schema/union.rb +29 -0
  51. data/lib/graphql/schema/warden.rb +2 -4
  52. data/lib/graphql/static_validation/rules/variables_are_used_and_defined.rb +4 -2
  53. data/lib/graphql/subscriptions.rb +69 -24
  54. data/lib/graphql/subscriptions/action_cable_subscriptions.rb +66 -11
  55. data/lib/graphql/subscriptions/broadcast_analyzer.rb +84 -0
  56. data/lib/graphql/subscriptions/default_subscription_resolve_extension.rb +21 -0
  57. data/lib/graphql/subscriptions/event.rb +16 -1
  58. data/lib/graphql/subscriptions/serialize.rb +22 -4
  59. data/lib/graphql/subscriptions/subscription_root.rb +3 -1
  60. data/lib/graphql/tracing.rb +1 -27
  61. data/lib/graphql/tracing/appoptics_tracing.rb +10 -2
  62. data/lib/graphql/tracing/platform_tracing.rb +25 -15
  63. data/lib/graphql/tracing/statsd_tracing.rb +42 -0
  64. data/lib/graphql/types/iso_8601_date_time.rb +2 -1
  65. data/lib/graphql/types/relay/base_connection.rb +6 -5
  66. data/lib/graphql/version.rb +1 -1
  67. metadata +5 -2
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ module GraphQL
4
+ module Tracing
5
+ class StatsdTracing < PlatformTracing
6
+ self.platform_keys = {
7
+ 'lex' => "graphql.lex",
8
+ 'parse' => "graphql.parse",
9
+ 'validate' => "graphql.validate",
10
+ 'analyze_query' => "graphql.analyze_query",
11
+ 'analyze_multiplex' => "graphql.analyze_multiplex",
12
+ 'execute_multiplex' => "graphql.execute_multiplex",
13
+ 'execute_query' => "graphql.execute_query",
14
+ 'execute_query_lazy' => "graphql.execute_query_lazy",
15
+ }
16
+
17
+ # @param statsd [Object] A statsd client
18
+ def initialize(statsd:, **rest)
19
+ @statsd = statsd
20
+ super(**rest)
21
+ end
22
+
23
+ def platform_trace(platform_key, key, data)
24
+ @statsd.time(platform_key) do
25
+ yield
26
+ end
27
+ end
28
+
29
+ def platform_field_key(type, field)
30
+ "graphql.#{type.graphql_name}.#{field.graphql_name}"
31
+ end
32
+
33
+ def platform_authorized_key(type)
34
+ "graphql.authorized.#{type.graphql_name}"
35
+ end
36
+
37
+ def platform_resolve_type_key(type)
38
+ "graphql.resolve_type.#{type.graphql_name}"
39
+ end
40
+ end
41
+ end
42
+ end
@@ -1,6 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'time'
2
4
 
3
- # frozen_string_literal: true
4
5
  module GraphQL
5
6
  module Types
6
7
  # This scalar takes `Time`s and transmits them as strings,
@@ -48,7 +48,7 @@ module GraphQL
48
48
  # It's called when you subclass this base connection, trying to use the
49
49
  # class name to set defaults. You can call it again in the class definition
50
50
  # to override the default (or provide a value, if the default lookup failed).
51
- def edge_type(edge_type_class, edge_class: GraphQL::Relay::Edge, node_type: edge_type_class.node_type, nodes_field: true)
51
+ def edge_type(edge_type_class, edge_class: GraphQL::Relay::Edge, node_type: edge_type_class.node_type, nodes_field: true, node_nullable: true)
52
52
  # Set this connection's graphql name
53
53
  node_type_name = node_type.graphql_name
54
54
 
@@ -61,7 +61,7 @@ module GraphQL
61
61
  description: "A list of edges.",
62
62
  edge_class: edge_class
63
63
 
64
- define_nodes_field if nodes_field
64
+ define_nodes_field(node_nullable) if nodes_field
65
65
 
66
66
  description("The connection type for #{node_type_name}.")
67
67
  end
@@ -90,9 +90,10 @@ module GraphQL
90
90
 
91
91
  private
92
92
 
93
- def define_nodes_field
94
- field :nodes, [@node_type, null: true],
95
- null: true,
93
+ def define_nodes_field(nullable = true)
94
+ type = nullable ? [@node_type, null: true] : [@node_type]
95
+ field :nodes, type,
96
+ null: nullable,
96
97
  description: "A list of nodes."
97
98
  end
98
99
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module GraphQL
3
- VERSION = "1.10.14"
3
+ VERSION = "1.11.4"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphql
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.14
4
+ version: 1.11.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Mosolgo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-29 00:00:00.000000000 Z
11
+ date: 2020-08-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: benchmark-ips
@@ -681,6 +681,8 @@ files:
681
681
  - lib/graphql/string_type.rb
682
682
  - lib/graphql/subscriptions.rb
683
683
  - lib/graphql/subscriptions/action_cable_subscriptions.rb
684
+ - lib/graphql/subscriptions/broadcast_analyzer.rb
685
+ - lib/graphql/subscriptions/default_subscription_resolve_extension.rb
684
686
  - lib/graphql/subscriptions/event.rb
685
687
  - lib/graphql/subscriptions/instrumentation.rb
686
688
  - lib/graphql/subscriptions/serialize.rb
@@ -696,6 +698,7 @@ files:
696
698
  - lib/graphql/tracing/prometheus_tracing/graphql_collector.rb
697
699
  - lib/graphql/tracing/scout_tracing.rb
698
700
  - lib/graphql/tracing/skylight_tracing.rb
701
+ - lib/graphql/tracing/statsd_tracing.rb
699
702
  - lib/graphql/type_kinds.rb
700
703
  - lib/graphql/types.rb
701
704
  - lib/graphql/types/big_int.rb