CursorSelector
Pages through an unbounded list with cursors; the base of every Item and Event selection.
Remarks
Section titled “Remarks”Selectors are immutable: each method returns a new selector, so a configured selector can be reused.
The page size is 100 until limit is called.
Example
Section titled “Example”Fetch two consecutive pages
const selector = template.selectItems().limit(100);const firstPage = await selector.execute();const secondPage = await selector.cursor(firstPage.cursor).execute();Extended by
Section titled “Extended by”Type Parameters
Section titled “Type Parameters”TResult
Section titled “TResult”TResult
The type of each result.
Methods
Section titled “Methods”cursor()
Section titled “cursor()”cursor(
value):this
Resumes the selection from a cursor returned with an earlier page.
Parameters
Section titled “Parameters”The cursor, a cursor with a new page size, or undefined to start from the beginning.
Returns
Section titled “Returns”this
Throws
Section titled “Throws”when called on a selection that has switched to offset pagination.
execute()
Section titled “execute()”execute():
Promise<CursorSelectorResult<TResult>>
Runs the selection and returns one page of results with the cursor for the next page.
Returns
Section titled “Returns”Promise<CursorSelectorResult<TResult>>
first()
Section titled “first()”first():
Promise<TResult|undefined>
Runs the selection for a single result.
Returns
Section titled “Returns”Promise<TResult | undefined>
The first result, or undefined when nothing matches.
iterator()
Section titled “iterator()”iterator():
AsyncGenerator<TResult,void,undefined>
Yields every result across all pages, fetching each page on demand at the current page size.
Returns
Section titled “Returns”AsyncGenerator<TResult, void, undefined>
Example
Section titled “Example”Walk every child of a Template
for await (const group of item.selectChildren().template(demographicGroup).iterator()) { // ...}limit()
Section titled “limit()”limit(
value):this
Sets the page size.
Parameters
Section titled “Parameters”number
A positive integer.
Returns
Section titled “Returns”this
Throws
Section titled “Throws”(error-008-invalid-selector-limit) when value is not a positive integer.

