CursorPaginator

Source
import { CursorPaginator } from "@prestojs/util";
Hierarchy
  • Paginator<
    An object with these properties:
    PropertyTypeDescription
    cursorstring
    pageSizenumber
    ,
    An object with these properties:
    PropertyTypeDescription
    nextCursorstring|null
    previousCursorstring|null
    >
  • CursorPaginator

API

Constructor

new CursorPaginator(?currentStatePair,?internalStatePair)
Params:
ParameterTypeDescription
currentStatePairnull
internalStatePairnull

Methods

first()
Returns:void
firstState()
Returns:
An object with these properties:
PropertyTypeDescription
cursorstring
pageSizenumber
getRequestInit(props)
Params:
ParameterTypeDescription
*
props
An object with the properties below
props.headersHeadersInit|Record
props.queryRecord
props.urlArgsRecord
...any
Any properties from RequestInit
Returns:
An object with these properties:
PropertyTypeDescription
headersHeadersInit|Record
queryRecord
urlArgsRecord
...any
Any properties from RequestInit
hasNextPage()
Returns:boolean
next()
Returns:void
nextState()
Returns:null|
An object with these properties:
PropertyTypeDescription
cursorstring
pageSizenumber
pageSizeState(pageSize)
Params:
ParameterTypeDescription
*pageSizenull|number
Returns:
An object with these properties:
PropertyTypeDescription
cursorstring
pageSizenumber
previous()
Returns:void
previousState()
Returns:null|
An object with these properties:
PropertyTypeDescription
cursorstring
pageSizenumber
replaceStateControllers(currentStatePair,internalStatePair)
Params:
ParameterTypeDescription
*currentStatePairany
*internalStatePairany
Returns:void
setCurrentState(set)
Params:
ParameterTypeDescription
*set
Returns:void
setInternalState(set)
Params:
ParameterTypeDescription
*set
Returns:void
setPageSize(pageSize)
Params:
ParameterTypeDescription
*pageSizenull|number
Returns:void
setResponse(props)
Params:
ParameterTypeDescription
*props
Returns:void

Properties

currentState

Source
An object with these properties:
PropertyTypeDescription
cursorstring
pageSizenumber

cursor

Source
null|string

internalState

Source
An object with these properties:
PropertyTypeDescription
nextCursorstring|null
previousCursorstring|null
responseIsSetboolean

nextCursor

Source
null|string

pageSize

Source
null|number

previousCursor

Source
null|string

responseIsSet

Source
boolean

Static Methods

getPaginationState(requestDetails)
Params:
ParameterTypeDescription
*
requestDetails
An object with the properties below
requestDetails.decodedBodyany
requestDetails.queryRecord
requestDetails.responseResponse
*requestDetails.urlstring
requestDetails.urlArgsRecord
Returns:false|Record