subgrounds.pagination.preprocess module

Helper functions and classes used by Subgrounds' own pagination strategies.

class subgrounds.pagination.preprocess.PaginationNode(node_idx, filter_field, first_value, skip_value, filter_value, filter_value_type, key_path, inner=<factory>)

Bases: object

Class representing the pagination config for a single GraphQL list field.

node_idx

Index of PaginationNode, used to label pagination arguments for this node.

Type

int

filter_field

Name of the node's filter field, e.g.: if filter_name is timestamp_gt, then filter_field is timestamp

Type

str

first_value

Initial value of the first argument

Type

int

skip_value

Initial value of the skip argument

Type

int

filter_value

Initial value of the filter argument (i.e.: where: {filter: FILTER_VALUE})

Type

Any

filter_value_type

Type of the filter value

Type

TypeRef.T

key_path

Location in the list field to which this pagination node refers to in the initial query

Type

list[str]

inner

Nested pagination nodes (if any).

Type

list[PaginationNode]

node_idx: int
filter_field: str
first_value: int
skip_value: int
filter_value: Any
filter_value_type: subgrounds.schema.TypeRef.T
key_path: list[str]
inner: list[subgrounds.pagination.preprocess.PaginationNode]
get_vardefs()

Returns a list of variable definitions corresponding to this pagination node's pagination arguments as well as the variable definitions related to any nested pagination nodes.

Parameters

self (PaginationNode) -- The current PaginationNode

Returns

_description_

Return type

list[VariableDefinition]

subgrounds.pagination.preprocess.is_pagination_node(schema, selection)
subgrounds.pagination.preprocess.get_orderBy_value(selection)
subgrounds.pagination.preprocess.get_orderDirection_value(selection)
subgrounds.pagination.preprocess.get_filtering_arg(selection)
subgrounds.pagination.preprocess.get_filtering_value(selection)
subgrounds.pagination.preprocess.generate_pagination_nodes(schema, document)
subgrounds.pagination.preprocess.normalize(schema, document, pagination_nodes)
subgrounds.pagination.preprocess.prune_doc(document, args)