EventCursorSelector
Selects appended Events with cursor paging, filtering on their lineage and metadata rather than their payloads.
Remarks
Section titled “Remarks”Events are immutable, so there is no write variant. The selector is available through
selectEvents in a sudo or system context.
Extends
Section titled “Extends”CursorSelector<TEvent>
Type Parameters
Section titled “Type Parameters”TEvent
Section titled “TEvent”TEvent
The type of each result.
Methods
Section titled “Methods”after()
Section titled “after()”after(
date):this
Restricts results to Events created after a time.
Parameters
Section titled “Parameters”number | Date | DateTime<boolean>
The time, as a Date, a Luxon DateTime or epoch milliseconds.
Returns
Section titled “Returns”this
before()
Section titled “before()”before(
date):this
Restricts results to Events created before a time.
Parameters
Section titled “Parameters”number | Date | DateTime<boolean>
The time, as a Date, a Luxon DateTime or epoch milliseconds.
Returns
Section titled “Returns”this
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.
Inherited from
Section titled “Inherited from”debug()
Section titled “debug()”debug():
this
Logs the resolved query when the selection runs.
Returns
Section titled “Returns”this
execute()
Section titled “execute()”execute():
Promise<CursorSelectorResult<TEvent>>
Runs the selection and returns one page of results with the cursor for the next page.
Returns
Section titled “Returns”Promise<CursorSelectorResult<TEvent>>
Inherited from
Section titled “Inherited from”first()
Section titled “first()”first():
Promise<TEvent|undefined>
Runs the selection for a single result.
Returns
Section titled “Returns”Promise<TEvent | undefined>
The first result, or undefined when nothing matches.
Inherited from
Section titled “Inherited from”itemId()
Section titled “itemId()”itemId(
id):this
Restricts results to Events targeting the given Items.
Parameters
Section titled “Parameters”One or more Item identifiers.
Returns
Section titled “Returns”this
iterator()
Section titled “iterator()”iterator():
AsyncGenerator<TEvent,void,undefined>
Yields every result across all pages, fetching each page on demand at the current page size.
Returns
Section titled “Returns”AsyncGenerator<TEvent, void, undefined>
Example
Section titled “Example”Walk every child of a Template
for await (const group of item.selectChildren().template(demographicGroup).iterator()) { // ...}Inherited from
Section titled “Inherited from”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.
Inherited from
Section titled “Inherited from”parentEvent()
Section titled “parentEvent()”parentEvent(
id):this
Restricts results to Events triggered directly by the given Events.
Parameters
Section titled “Parameters”One or more identifiers of parent Events.
Returns
Section titled “Returns”this
prn(
prn):this
Restricts results to Events of the given types.
Parameters
Section titled “Parameters”string | string[]
One or more Event PRNs, as declared in the Definition.
Returns
Section titled “Returns”this
rootParent()
Section titled “rootParent()”rootParent(
id):this
Restricts results to Events descending from the given top-level Events of their traces.
Parameters
Section titled “Parameters”One or more identifiers of root Events.
Returns
Section titled “Returns”this
traceId()
Section titled “traceId()”traceId(
id):this
Restricts results to Events sharing a trace.
Parameters
Section titled “Parameters”string
The trace identifier.
Returns
Section titled “Returns”this

