Skip to content

Packages  ›  trotsky  ›  StepBuilderList

StepBuilderList class

Abstract class representing a step that processes paginated lists.

Signature:

typescript
export declare abstract class StepBuilderList<P = StepBuilder, C = unknown, O extends StepBuilderListOutput = StepBuilderListOutput> extends Step<P, C, O>

Extends: Step<P, C, O>

Properties

Property

Modifiers

Type

Description

_iterator?

StepBuilderListIterator

(Optional) Optional tterator function to be executed for each item in the list.

_skip

Resolvable<number>

Number of items to skip from the start of the list. Defaults to 0.

_steps

StepBuilderListEntry<this>[]

Holds the list of steps to be executed for each entry in the list.

_take

Resolvable<number>

Number of items to take from the list. Defaults to Infinity.

Methods

Method

Modifiers

Description

apply()

Applies the list processing logic, including pagination and execution of child steps for each item in the output.

applyPagination()

abstract

Abstract method to handle pagination. Must be implemented by subclasses.

clone(rest)

Clones the current step and returns a new instance with the same parameters.

each(iterator)

Appends a new entry processing step to the list.

paginate(attribute, fn)

Handles pagination logic for retrieving records, fetching items in batches until the desired size is reached.

skip(skip)

Sets the number of items to skip from the start of the list.

take(take)

Sets the number of items to take from the list.

withIterator(iterator)

Sets the iterator function to be executed for each item in the list.