ItemPaginateSelector
Selects Items of any Template with offset paging.
Extends
Section titled “Extends”BaseSelector.PaginateSelector<TItem>
Type Parameters
Section titled “Type Parameters”TItem
The type of each result.
Methods
Section titled “Methods”archived()
Section titled “archived()”archived(
include):this
Chooses whether archived Items are left out, included, or the only results.
Parameters
Section titled “Parameters”include
Section titled “include”boolean | "exclude" | "include" | "only"
true or 'include' to include archived Items, 'only' for archived Items alone, false or
'exclude' to leave them out.
Returns
Section titled “Returns”this
Remarks
Section titled “Remarks”Archived Items are left out until this is called.
Inherited from
Section titled “Inherited from”BaseSelector.archived
assign()
Section titled “assign()”assign(
input):this
Applies the criteria of an ItemQuery, such as one received from a client, over the current criteria.
Parameters
Section titled “Parameters”The query to apply; it is validated before use.
Returns
Section titled “Returns”this
Throws
Section titled “Throws”when input is not a valid ItemQuery.
Inherited from
Section titled “Inherited from”BaseSelector.assign
debug()
Section titled “debug()”debug():
this
Logs the resolved query when the selection runs.
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”BaseSelector.debug
execute()
Section titled “execute()”execute():
Promise<PageSelectorResult<TItem>>
Runs the selection and returns the requested page with its totals.
Returns
Section titled “Returns”Promise<PageSelectorResult<TItem>>
Inherited from
Section titled “Inherited from”exists()
Section titled “exists()”exists():
Promise<boolean>
Checks whether anything matches the selection, without ordering or reading the results, so the database can stop at the first match.
Returns
Section titled “Returns”Promise<boolean>
Whether at least one Item matches.
Remarks
Section titled “Remarks”Cheaper than first() on a large set of matches, which sorts every match to find the first.
Unlike first() and execute(), the check is not permission filtered: it is true when an Item matches whatever
the active principal can read (as with totalCount of a paginated selection). Run it with sudo for a yes/no
question about Items the principal may not read.
Inherited from
Section titled “Inherited from”BaseSelector.exists
first()
Section titled “first()”first():
Promise<TItem|undefined>
Runs the selection for a single result.
Returns
Section titled “Returns”Promise<TItem | undefined>
The first result, or undefined when nothing matches.
Inherited from
Section titled “Inherited from”id(
itemOrItems):this
Restricts results to the given Items.
Parameters
Section titled “Parameters”itemOrItems
Section titled “itemOrItems”One or more identifiers; an empty list matches nothing.
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”BaseSelector.id
key(
key):this
Restricts results to Items carrying one of the given keys.
Parameters
Section titled “Parameters”string | string[]
One or more keys; each must be a valid key.
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”BaseSelector.key
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”onlyPrn()
Section titled “onlyPrn()”onlyPrn(
prn):TemplateItemPaginateSelector<TItem>
Narrows the selection to the given Template or Union PRNs, replacing any given earlier.
Parameters
Section titled “Parameters”string | string[]
One or more Template or Union PRNs.
Returns
Section titled “Returns”TemplateItemPaginateSelector<TItem>
parent()
Section titled “parent()”parent(
parentOrParents):this
Restricts results to direct children of the given parents.
Parameters
Section titled “Parameters”parentOrParents
Section titled “parentOrParents”One or more parent identifiers; an empty list matches nothing.
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”BaseSelector.parent
prn(
prn):TemplateItemPaginateSelector<TItem>
Narrows the selection to Items of the given Template or Union PRNs, in addition to any given earlier.
Parameters
Section titled “Parameters”string | string[]
One or more Template or Union PRNs.
Returns
Section titled “Returns”TemplateItemPaginateSelector<TItem>
search()
Section titled “search()”search(
idx,query):this
Restricts results to Items matching a search query against a search index.
Parameters
Section titled “Parameters”The search index to query.
The term and facets to match.
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”BaseSelector.search
state()
Section titled “state()”state(
state):this
Restricts results to Items in one of the given states.
Parameters
Section titled “Parameters”string | string[]
One or more state keys; an empty list removes the state criterion.
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”BaseSelector.state
template()
Section titled “template()”template(
template):TemplateItemPaginateSelector<TItem>
Narrows the selection to Items of a Template, in addition to any Templates or Unions given earlier.
Parameters
Section titled “Parameters”template
Section titled “template”The Template.
string
Returns
Section titled “Returns”TemplateItemPaginateSelector<TItem>
union()
Section titled “union()”union(
template):TemplateItemCursorSelector<TItem>
Narrows the selection to Items of a Union’s member Templates, in addition to any Templates or Unions given earlier.
Parameters
Section titled “Parameters”template
Section titled “template”The Union.
string
Returns
Section titled “Returns”TemplateItemCursorSelector<TItem>

