Class: GraphQL::Stitching::PlannerStep

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

Overview

A planned step in the sequence of stitching entrypoints together. This is a mutable object that may change throughout the planning process. It ultimately builds an immutable Plan::Op at the end of planning.

Constant Summary collapse

GRAPHQL_PRINTER =
GraphQL::Language::Printer.new

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(location:, parent_type:, index:, after: nil, operation_type: "query", selections: [], variables: {}, path: [], boundary: nil) ⇒ PlannerStep

Returns a new instance of PlannerStep.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/graphql/stitching/planner_step.rb', line 14

def initialize(
  location:,
  parent_type:,
  index:,
  after: nil,
  operation_type: "query",
  selections: [],
  variables: {},
  path: [],
  boundary: nil
)
  @location = location
  @parent_type = parent_type
  @index = index
  @after = after
  @operation_type = operation_type
  @selections = selections
  @variables = variables
  @path = path
  @boundary = boundary
end

Instance Attribute Details

#afterObject

Returns the value of attribute after.



12
13
14
# File 'lib/graphql/stitching/planner_step.rb', line 12

def after
  @after
end

#boundaryObject

Returns the value of attribute boundary.



12
13
14
# File 'lib/graphql/stitching/planner_step.rb', line 12

def boundary
  @boundary
end

#indexObject (readonly)

Returns the value of attribute index.



11
12
13
# File 'lib/graphql/stitching/planner_step.rb', line 11

def index
  @index
end

#locationObject (readonly)

Returns the value of attribute location.



11
12
13
# File 'lib/graphql/stitching/planner_step.rb', line 11

def location
  @location
end

#operation_typeObject (readonly)

Returns the value of attribute operation_type.



11
12
13
# File 'lib/graphql/stitching/planner_step.rb', line 11

def operation_type
  @operation_type
end

#parent_typeObject (readonly)

Returns the value of attribute parent_type.



11
12
13
# File 'lib/graphql/stitching/planner_step.rb', line 11

def parent_type
  @parent_type
end

#pathObject (readonly)

Returns the value of attribute path.



11
12
13
# File 'lib/graphql/stitching/planner_step.rb', line 11

def path
  @path
end

#selectionsObject

Returns the value of attribute selections.



12
13
14
# File 'lib/graphql/stitching/planner_step.rb', line 12

def selections
  @selections
end

#variablesObject

Returns the value of attribute variables.



12
13
14
# File 'lib/graphql/stitching/planner_step.rb', line 12

def variables
  @variables
end

Instance Method Details

#to_plan_opObject



36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/graphql/stitching/planner_step.rb', line 36

def to_plan_op
  GraphQL::Stitching::Plan::Op.new(
    step: @index,
    after: @after,
    location: @location,
    operation_type: @operation_type,
    selections: rendered_selections,
    variables: rendered_variables,
    path: @path,
    if_type: type_condition,
    boundary: @boundary,
  )
end