Class: GraphQL::Stitching::Planner
- Inherits:
-
Object
- Object
- GraphQL::Stitching::Planner
- Defined in:
- lib/graphql/stitching/planner.rb
Constant Summary collapse
- SUPERGRAPH_LOCATIONS =
[Supergraph::LOCATION].freeze
- TYPENAME_NODE =
GraphQL::Language::Nodes::Field.new(alias: "_STITCH_typename", name: "__typename")
Instance Method Summary collapse
-
#initialize(supergraph:, request:) ⇒ Planner
constructor
A new instance of Planner.
- #operations ⇒ Object
- #perform ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(supergraph:, request:) ⇒ Planner
Returns a new instance of Planner.
9 10 11 12 13 14 |
# File 'lib/graphql/stitching/planner.rb', line 9 def initialize(supergraph:, request:) @supergraph = supergraph @request = request @sequence_key = 0 @operations_by_grouping = {} end |
Instance Method Details
#operations ⇒ Object
22 23 24 |
# File 'lib/graphql/stitching/planner.rb', line 22 def operations @operations_by_grouping.values.sort_by!(&:key) end |
#perform ⇒ Object
16 17 18 19 20 |
# File 'lib/graphql/stitching/planner.rb', line 16 def perform build_root_operations self end |
#to_h ⇒ Object
26 27 28 |
# File 'lib/graphql/stitching/planner.rb', line 26 def to_h { "ops" => operations.map!(&:to_h) } end |