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)

Arguments:

ArgumentTypeDescription
currentStatePairnull
internalStatePairnull

Methods

first()
Returns:void
firstState()
Returns:
An object with these properties:
PropertyTypeDescription
cursorstring
pageSizenumber
getRequestInit(props)

Arguments:

ArgumentTypeDescription
*
props
An object with the properties below
props.headersHeadersInit|Record
props.queryRecord
props.urlArgsRecord
...any
Any properties from RequestInit except for these:
  • headers
Returns:
An object with these properties:
PropertyTypeDescription
headersHeadersInit|Record
queryRecord
urlArgsRecord
...any
Any properties from RequestInit except for these:
  • headers
hasNextPage()
Returns:boolean
next()
Returns:void
nextState()
Returns:null|
An object with these properties:
PropertyTypeDescription
cursorstring
pageSizenumber
pageSizeState(pageSize)

Arguments:

ArgumentTypeDescription
*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)

Arguments:

ArgumentTypeDescription
*currentStatePairany
*internalStatePairany
Returns:void
setCurrentState(set)

Component Props:

PropTypeDescription
*set
setInternalState(set)

Component Props:

PropTypeDescription
*set
setPageSize(pageSize)

Arguments:

ArgumentTypeDescription
*pageSizenull|number
Returns:void
setResponse(props)

Arguments:

ArgumentTypeDescription
*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)

Arguments:

ArgumentTypeDescription
*
requestDetails
An object with the properties below
requestDetails.decodedBodyany
requestDetails.queryRecord
requestDetails.responseResponse
*requestDetails.urlstring
requestDetails.urlArgsRecord
Returns:false|Record