@@ -42,7 +42,7 @@ def initialize(query, metafield_ns = "custom")
4242 @query = query
4343 @schema = query . schema
4444 @app_context = directive_kwargs ( @schema . schema_directives , "app" ) &.dig ( :id )
45- @owner_types = @schema . possible_types ( @schema . get_type ( "HasMetafields" ) ) . to_set
45+ @owner_types = @schema . possible_types ( @query . get_type ( "HasMetafields" ) ) . to_set
4646 @root_ext_name = MetafieldTypeResolver . extensions_typename ( @schema . query . graphql_name )
4747 @transform_map = TransformationMap . new ( @app_context )
4848 @metafield_ns = metafield_ns
@@ -71,13 +71,13 @@ def transform_scope(parent_type, input_selections, scope_type: NATIVE_SCOPE, sco
7171 if scope_type == NATIVE_SCOPE && node . name == "extensions" && ( parent_type == @schema . query || @owner_types . include? ( parent_type ) )
7272 @transform_map . apply_field_transform ( FieldTransform . new ( NAMESPACE_TRANSFORM ) )
7373 with_namespace_anchor_field ( node ) do
74- next_type = parent_type . get_field ( node . name ) . type . unwrap
74+ next_type = @query . get_field ( parent_type , node . name ) . type . unwrap
7575 transform_scope ( next_type , node . selections , scope_type : EXTENSIONS_SCOPE , scope_ns : node . alias || node . name )
7676 end
7777 elsif scope_type == METAOBJECT_SCOPE && node . name == "system"
7878 @transform_map . apply_field_transform ( FieldTransform . new ( NAMESPACE_TRANSFORM ) )
7979 with_namespace_anchor_field ( node ) do
80- next_type = parent_type . get_field ( node . name ) . type . unwrap
80+ next_type = @query . get_field ( parent_type , node . name ) . type . unwrap
8181 transform_scope ( next_type , node . selections , scope_ns : node . alias || node . name )
8282 end
8383 elsif scope_type == EXTENSIONS_SCOPE && parent_type . graphql_name == @root_ext_name
@@ -89,15 +89,15 @@ def transform_scope(parent_type, input_selections, scope_type: NATIVE_SCOPE, sco
8989 node = node . merge ( alias : "#{ RESERVED_PREFIX } #{ scope_ns } _#{ node . alias || node . name } " )
9090 end
9191 if node . selections &.any?
92- next_type = parent_type . get_field ( node . name ) . type . unwrap
92+ next_type = @query . get_field ( parent_type , node . name ) . type . unwrap
9393 node = node . merge ( selections : transform_scope ( next_type , node . selections ) )
9494 end
9595 node
9696 end
9797 end
9898
9999 when GraphQL ::Language ::Nodes ::InlineFragment
100- fragment_type = node . type . nil? ? parent_type : @schema . get_type ( node . type . name )
100+ fragment_type = node . type . nil? ? parent_type : @query . get_type ( node . type . name )
101101 with_typed_condition ( parent_type , fragment_type , scope_type ) do
102102 if MetafieldTypeResolver . extensions_type? ( fragment_type . graphql_name )
103103 transform_scope ( fragment_type , node . selections , scope_type : EXTENSIONS_SCOPE , scope_ns : scope_ns )
@@ -116,7 +116,7 @@ def transform_scope(parent_type, input_selections, scope_type: NATIVE_SCOPE, sco
116116
117117 when GraphQL ::Language ::Nodes ::FragmentSpread
118118 fragment_def = @query . fragments [ node . name ]
119- fragment_type = @schema . get_type ( fragment_def . type . name )
119+ fragment_type = @query . get_type ( fragment_def . type . name )
120120 with_typed_condition ( parent_type , fragment_type , scope_type ) do
121121 unless @new_fragments [ node . name ]
122122 fragment_type_name = fragment_type . graphql_name
@@ -175,7 +175,7 @@ def with_typed_condition(parent_type, fragment_type, scope_type)
175175
176176 # connections must map transformations through possible `edges -> node` and `nodes` pathways
177177 def build_connection_selections ( conn_type , conn_node )
178- conn_node_type = conn_type . get_field ( "nodes" ) . type . unwrap
178+ conn_node_type = @query . get_field ( conn_type , "nodes" ) . type . unwrap
179179 conn_node . selections . map do |node |
180180 @transform_map . field_breadcrumb ( node ) do
181181 case node . name
@@ -186,7 +186,7 @@ def build_connection_selections(conn_type, conn_node)
186186 when "node"
187187 n . merge ( selections : yield ( conn_node_type , n . selections ) )
188188 when GQL_TYPENAME
189- edge_type = conn_type . get_field ( "edges" ) . type . unwrap
189+ edge_type = @query . get_field ( conn_type , "edges" ) . type . unwrap
190190 @transform_map . apply_field_transform ( FieldTransform . new ( STATIC_TYPENAME_TRANSFORM , value : edge_type . graphql_name ) )
191191 n
192192 else
@@ -210,10 +210,10 @@ def build_connection_selections(conn_type, conn_node)
210210 def build_metaobject_query ( parent_type , node , scope_ns : nil )
211211 return build_typename ( parent_type , node , scope_type : EXTENSIONS_SCOPE , scope_ns : scope_ns ) if node . name == GQL_TYPENAME
212212
213- field_type = parent_type . get_field ( node . name ) . type . unwrap
213+ field_type = @query . get_field ( parent_type , node . name ) . type . unwrap
214214 return node unless MetafieldTypeResolver . connection_type? ( field_type . graphql_name )
215215
216- node_type = field_type . get_field ( "nodes" ) . type . unwrap
216+ node_type = @query . get_field ( field_type , "nodes" ) . type . unwrap
217217 metaobject_type = directive_kwargs ( node_type . directives , "metaobject" ) &.dig ( :type )
218218 return node unless metaobject_type
219219
@@ -232,7 +232,7 @@ def build_metaobject_query(parent_type, node, scope_ns: nil)
232232 def build_metafield ( parent_type , node , scope_type :, scope_ns : nil )
233233 return build_typename ( parent_type , node , scope_type : scope_type , scope_ns : scope_ns ) if node . name == GQL_TYPENAME
234234
235- field = parent_type . get_field ( node . name )
235+ field = @query . get_field ( parent_type , node . name )
236236 metafield_attrs = directive_kwargs ( field . directives , "metafield" )
237237 return node unless metafield_attrs
238238
0 commit comments