module GraphQL::Types::Relay::ConnectionBehaviors
def self.included(child_class)
def self.included(child_class) child_class.extend(ClassMethods) child_class.has_nodes_field(true) child_class.node_nullable(true) child_class.edges_nullable(true) child_class.edge_nullable(true) child_class.module_exec { self.edge_type = nil self.node_type = nil self.edge_class = nil } child_class.default_broadcastable(nil) add_page_info_field(child_class) end
def add_page_info_field(obj_type)
def add_page_info_field(obj_type) obj_type.field :page_info, GraphQL::Types::Relay::PageInfo, null: false, description: "Information to aid in pagination." end
def edges
def edges # Assume that whatever authorization needed to happen # already happened at the connection level. current_runtime_state = Fiber[:__graphql_runtime_info] query_runtime_state = current_runtime_state[context.query] query_runtime_state.was_authorized_by_scope_items = @object.was_authorized_by_scope_items? @object.edges end
def nodes
def nodes # Assume that whatever authorization needed to happen # already happened at the connection level. current_runtime_state = Fiber[:__graphql_runtime_info] query_runtime_state = current_runtime_state[context.query] query_runtime_state.was_authorized_by_scope_items = @object.was_authorized_by_scope_items? @object.nodes end