Class: GraphQL::Stitching::Planner

Inherits:
Object
  • Object
show all
Defined in:
lib/graphql/stitching/planner.rb

Defined Under Namespace

Classes: ScopePartition

Constant Summary collapse

SUPERGRAPH_LOCATIONS =
[Supergraph::LOCATION].freeze
QUERY_OP =
"query"
MUTATION_OP =
"mutation"
ROOT_INDEX =
0

Instance Method Summary collapse

Constructor Details

#initialize(supergraph:, request:) ⇒ Planner

Returns a new instance of Planner.



11
12
13
14
15
16
# File 'lib/graphql/stitching/planner.rb', line 11

def initialize(supergraph:, request:)
  @supergraph = supergraph
  @request = request
  @planning_index = ROOT_INDEX
  @steps_by_entrypoint = {}
end

Instance Method Details

#performObject



18
19
20
21
22
# File 'lib/graphql/stitching/planner.rb', line 18

def perform
  build_root_entrypoints
  expand_abstract_boundaries
  Plan.new(ops: steps.map(&:to_plan_op))
end

#stepsObject



24
25
26
# File 'lib/graphql/stitching/planner.rb', line 24

def steps
  @steps_by_entrypoint.values.sort_by!(&:index)
end