apollo-federation 3.10.0 → 3.10.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 124963b377f399d88622c2d85341c54a248a096ca2f89e6dcde01033d96e151d
4
- data.tar.gz: ad7d7e3048937c768796118c0cc64766d3cf61d3548c4598463e7851fc5f3acb
3
+ metadata.gz: 799ff7dcaaf88157b7d98afb7928b2a269005d446b278090acd4f23085f86632
4
+ data.tar.gz: c42b4221e12c9ac01751a342ea077fba533d8859167518d09805239e83f6935f
5
5
  SHA512:
6
- metadata.gz: 115133bca324a2ff648306b95037df023180e31a40d005c3e9c128f0975a6ba7f1858afa6319a218b7de20655f8de191e348be1f419dfe29d2eac60208876337
7
- data.tar.gz: '005209e736ac0771a4b1518bec183b0e768f0a4d96e8b0a1a8ccc29ab89176732f09e7c27f5c83088f37aa674a9dd9f55e5060afc13fb5da73ca923b58ed244a'
6
+ metadata.gz: 272e6b2fa822f86c18dac2d9b2b0caf3e8ab6c297d9b277851848df3afcff9aba6d97dafd1c40cf334cd9c4c80c7ac230d4eafb21da6a574e973f6727631728f
7
+ data.tar.gz: 26de2d9c4c18f072dd9ccc11359081673288971c87ade3d9808e0e6976c8f93436016a81fdb43338e63406d7d0eacc590ca97289c7efd9ec5872ebf182d2879c
data/CHANGELOG.md CHANGED
@@ -1,3 +1,22 @@
1
+ ## [3.10.3](https://github.com/Gusto/apollo-federation-ruby/compare/v3.10.2...v3.10.3) (2025-10-20)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * random update to README.md to trigger semantic-release ([#310](https://github.com/Gusto/apollo-federation-ruby/issues/310)) ([bfaa10e](https://github.com/Gusto/apollo-federation-ruby/commit/bfaa10e85a7e85781f2ae0373d656b0fc66d13eb))
7
+
8
+
9
+ ### Reverts
10
+
11
+ * Revert "chore(release): 3.10.2 [skip ci]" (#309) ([a3937c6](https://github.com/Gusto/apollo-federation-ruby/commit/a3937c64f0ce9648edc10f74a80a4e825e01b4d4)), closes [#309](https://github.com/Gusto/apollo-federation-ruby/issues/309)
12
+
13
+ ## [3.10.1](https://github.com/Gusto/apollo-federation-ruby/compare/v3.10.0...v3.10.1) (2025-04-02)
14
+
15
+
16
+ ### Bug Fixes
17
+
18
+ * graphql-ruby 2.3 compatibility ([#294](https://github.com/Gusto/apollo-federation-ruby/issues/294)) ([be81a67](https://github.com/Gusto/apollo-federation-ruby/commit/be81a6762d036ea4b2e92ba23c36a7b178d68e90))
19
+
1
20
  # [3.10.0](https://github.com/Gusto/apollo-federation-ruby/compare/v3.9.0...v3.10.0) (2025-02-05)
2
21
 
3
22
 
data/README.md CHANGED
@@ -1,9 +1,10 @@
1
1
  # apollo-federation
2
2
 
3
- [![CircleCI](https://circleci.com/gh/Gusto/apollo-federation-ruby/tree/main.svg?style=svg)](https://circleci.com/gh/Gusto/apollo-federation-ruby/tree/main)
3
+ [![CI](https://github.com/Gusto/apollo-federation-ruby/actions/workflows/ci.yml/badge.svg)](https://github.com/Gusto/apollo-federation-ruby/actions/workflows/ci.yml)
4
4
 
5
5
  This gem extends the [GraphQL Ruby](http://graphql-ruby.org/) gem to add support for creating an [Apollo Federation](https://www.apollographql.com/docs/apollo-server/federation/introduction/) schema.
6
6
 
7
+
7
8
  ## Installation
8
9
 
9
10
  Add this line to your application's Gemfile:
@@ -144,7 +145,9 @@ This will start up the gateway and serve it at http://localhost:5000.
144
145
 
145
146
  ## Usage
146
147
 
147
- The API is designed to mimic the API of [Apollo's federation library](https://www.apollographql.com/docs/apollo-server/federation/introduction/). It's best to read and understand the way federation works, in general, before attempting to use this library.
148
+ The API is designed to mimic the API of [Apollo's federation library](https://www.apollographql.com/docs/apollo-server/federation/introduction/).
149
+
150
+ It's best to read and understand the way federation works, in general, before attempting to use this library.
148
151
 
149
152
  ### Extending a type
150
153
 
@@ -362,7 +365,7 @@ end
362
365
 
363
366
  To support [federated tracing](https://www.apollographql.com/docs/apollo-server/federation/metrics/):
364
367
 
365
- 1. Add `use ApolloFederation::Tracing` to your schema class.
368
+ 1. Add `trace_with ApolloFederation::Tracing::Tracer` to your schema class.
366
369
  2. Change your controller to add `tracing_enabled: true` to the execution context based on the presence of the "include trace" header:
367
370
  ```ruby
368
371
  def execute
@@ -471,6 +474,7 @@ See discussion at [#74](https://github.com/Gusto/apollo-federation-ruby/issues/7
471
474
  ## Maintainers
472
475
 
473
476
  Gusto GraphQL Team:
477
+
474
478
  - [Sara Laupp](https://github.com/slauppy)
475
479
  - [Seth Copeland](https://github.com/sethc2)
476
480
  - [Simon Coffin](https://github.com/simoncoffin)
@@ -69,7 +69,7 @@ module ApolloFederation
69
69
  def build_type_definition_nodes(types)
70
70
  non_federation_types = types.select do |type|
71
71
  if query_type?(type)
72
- !warden.fields(type).all? { |field| FEDERATION_QUERY_FIELDS.include?(field.graphql_name) }
72
+ !fields_for_type(type).all? { |field| FEDERATION_QUERY_FIELDS.include?(field.graphql_name) }
73
73
  else
74
74
  !FEDERATION_TYPES.include?(type.graphql_name)
75
75
  end
@@ -79,8 +79,23 @@ module ApolloFederation
79
79
 
80
80
  private
81
81
 
82
+ def fields_for_type(type)
83
+ return warden.fields(type) if use_warden?
84
+
85
+ @types.fields(type)
86
+ end
87
+
82
88
  def query_type?(type)
83
- type == warden.root_type_for_operation('query')
89
+ return type == warden.root_type_for_operation('query') if use_warden?
90
+
91
+ type == @types.query_root
92
+ end
93
+
94
+ # graphql-ruby 2.3.8 removed the warden definition from a number of places:
95
+ # https://github.com/rmosolgo/graphql-ruby/compare/v2.3.7...v2.3.8#diff-e9dd0d295a58b66fabd1cf717040de5a78ade0feac6aeabae5247b5785c029ab
96
+ # The internal usage of `warden` was replaced with `types` in many cases.
97
+ def use_warden?
98
+ Gem::Version.new(GraphQL::VERSION) < Gem::Version.new('2.3.8')
84
99
  end
85
100
 
86
101
  def merge_directives(node, type)
@@ -26,8 +26,10 @@
26
26
  #
27
27
  # </execute_query_lazy>
28
28
  #
29
- # # `execute_query_lazy` *always* fires, so it's a
30
- # # safe place to capture ending times of the full query.
29
+ # # In graphql-ruby < 2.5.12, `execute_query_lazy` *always* fires.
30
+ # # In graphql-ruby >= 2.5.12, `execute_query_lazy` only fires when there are lazy values.
31
+ # # We record end times in both `execute_multiplex` (as a fallback) and `execute_query_lazy`
32
+ # # (to capture the full execution time including lazy resolution when present).
31
33
  #
32
34
  # </execute_multiplex>
33
35
 
@@ -40,6 +42,40 @@ module ApolloFederation
40
42
  EXECUTE_FIELD = 'execute_field'
41
43
  EXECUTE_FIELD_LAZY = 'execute_field_lazy'
42
44
 
45
+ def execute_multiplex(multiplex:)
46
+ ApolloFederation::Tracing::Tracer.execute_multiplex(multiplex: multiplex) { yield }
47
+ end
48
+
49
+ def execute_query_lazy(query:, multiplex:)
50
+ ApolloFederation::Tracing::Tracer.execute_query_lazy(query: query, multiplex: multiplex) { yield }
51
+ end
52
+
53
+ def execute_field(field:, query:, ast_node:, arguments:, object:)
54
+ ApolloFederation::Tracing::Tracer.execute_field(
55
+ field: field,
56
+ query: query,
57
+ ast_node: ast_node,
58
+ arguments: arguments,
59
+ object: object,
60
+ owner: field.owner,
61
+ path: query.context[:current_path],
62
+ ) { yield }
63
+ end
64
+
65
+ def execute_field_lazy(field:, query:, ast_node:, arguments:, object:)
66
+ ApolloFederation::Tracing::Tracer.execute_field_lazy(
67
+ field: field,
68
+ query: query,
69
+ ast_node: ast_node,
70
+ arguments: arguments,
71
+ object: object,
72
+ owner: field.owner,
73
+ path: query.context[:current_path],
74
+ ) { yield }
75
+ end
76
+
77
+ # The method below was used by older versions of graphql-ruby.
78
+ # After graphq-ruby 2.3.0 the trace modules should respond to specific methods such as `execute_field` above.
43
79
  def self.trace(key, data, &block)
44
80
  case key
45
81
  when EXECUTE_MULTIPLEX
@@ -62,6 +98,12 @@ module ApolloFederation
62
98
 
63
99
  results = block.call
64
100
 
101
+ # Step 4.5:
102
+ # Record end times for all queries.
103
+ # This acts as a fallback for queries without lazy values.
104
+ # execute_query_lazy will overwrite these times if lazy values are present.
105
+ data.fetch(:multiplex).queries.each { |query| record_trace_end_time(query) }
106
+
65
107
  # Step 5
66
108
  # Attach the trace to the 'extensions' key of each result
67
109
  results.map { |result| attach_trace_to_result(result) }
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ApolloFederation
4
- VERSION = '3.10.0'
4
+ VERSION = '3.10.3'
5
5
  end
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apollo-federation
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.10.0
4
+ version: 3.10.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Noa Elad
8
8
  - Rylan Collins
9
+ autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2025-02-05 00:00:00.000000000 Z
12
+ date: 2025-10-20 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: graphql
@@ -84,16 +85,16 @@ dependencies:
84
85
  name: rack
85
86
  requirement: !ruby/object:Gem::Requirement
86
87
  requirements:
87
- - - ">="
88
+ - - "~>"
88
89
  - !ruby/object:Gem::Version
89
- version: '0'
90
+ version: '2.0'
90
91
  type: :development
91
92
  prerelease: false
92
93
  version_requirements: !ruby/object:Gem::Requirement
93
94
  requirements:
94
- - - ">="
95
+ - - "~>"
95
96
  - !ruby/object:Gem::Version
96
- version: '0'
97
+ version: '2.0'
97
98
  - !ruby/object:Gem::Dependency
98
99
  name: rackup
99
100
  requirement: !ruby/object:Gem::Requirement
@@ -253,6 +254,7 @@ metadata:
253
254
  changelog_uri: https://github.com/Gusto/apollo-federation-ruby/releases
254
255
  source_code_uri: https://github.com/Gusto/apollo-federation-ruby
255
256
  bug_tracker_uri: https://github.com/Gusto/apollo-federation-ruby/issues
257
+ post_install_message:
256
258
  rdoc_options: []
257
259
  require_paths:
258
260
  - lib
@@ -267,7 +269,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
267
269
  - !ruby/object:Gem::Version
268
270
  version: '0'
269
271
  requirements: []
270
- rubygems_version: 3.6.2
272
+ rubygems_version: 3.5.22
273
+ signing_key:
271
274
  specification_version: 4
272
275
  summary: A Ruby implementation of Apollo Federation
273
276
  test_files: []