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")
- ROOT_ORDER =
0
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.
10 11 12 13 14 15 |
# File 'lib/graphql/stitching/planner.rb', line 10 def initialize(supergraph:, request:) @supergraph = supergraph @request = request @planning_order = ROOT_ORDER @operations_by_entrypoint = {} end |
Instance Method Details
#operations ⇒ Object
23 24 25 |
# File 'lib/graphql/stitching/planner.rb', line 23 def operations @operations_by_entrypoint.values.sort_by!(&:order) end |
#perform ⇒ Object
17 18 19 20 21 |
# File 'lib/graphql/stitching/planner.rb', line 17 def perform build_root_entrypoints self end |
#to_h ⇒ Object
27 28 29 |
# File 'lib/graphql/stitching/planner.rb', line 27 def to_h { "ops" => operations.map!(&:to_h) } end |