InferredPaginator

Source
import { InferredPaginator } from "@prestojs/util";

API

Constructor

new InferredPaginator(currentStatePair,internalStatePair)
Params:
ParameterTypeDescription
*currentStatePairany
*internalStatePairany

Methods

first()
Returns:void
firstState()
Returns:null|
An object with these properties:
PropertyTypeDescription
cursorstring
pageSizenumber
|
An object with these properties:
PropertyTypeDescription
pagestring|number
pageSizestring|number
|
An object with these properties:
PropertyTypeDescription
limitnumber|string
offsetnumber|string
getRequestInit(currentInit)
Params:
ParameterTypeDescription
*currentInitany
Returns:
An object with these properties:
PropertyTypeDescription
headersHeadersInit|Record
queryRecord
urlArgsRecord
...any
Any properties from RequestInit
hasNextPage()
Returns:boolean
last()
Returns:void
lastState()
Returns:null|
An object with these properties:
PropertyTypeDescription
pagestring|number
pageSizestring|number
|
An object with these properties:
PropertyTypeDescription
limitnumber|string
offsetnumber|string
limitState(limit)
Params:
ParameterTypeDescription
*limitnull|number
Returns:null|
An object with these properties:
PropertyTypeDescription
limitnumber|string
offsetnumber|string
next()
Returns:void
nextState()
Returns:null|
An object with these properties:
PropertyTypeDescription
cursorstring
pageSizenumber
|
An object with these properties:
PropertyTypeDescription
pagestring|number
pageSizestring|number
|
An object with these properties:
PropertyTypeDescription
limitnumber|string
offsetnumber|string
offsetState(offset)
Params:
ParameterTypeDescription
*offsetnull|number
Returns:null|
An object with these properties:
PropertyTypeDescription
limitnumber|string
offsetnumber|string
pageSizeState(pageSize)
Params:
ParameterTypeDescription
*pageSizenull|number
Returns:null|
An object with these properties:
PropertyTypeDescription
cursorstring
pageSizenumber
|
An object with these properties:
PropertyTypeDescription
pagestring|number
pageSizestring|number
pageState(page)
Params:
ParameterTypeDescription
*pagenumber
Returns:null|
An object with these properties:
PropertyTypeDescription
pagestring|number
pageSizestring|number
previous()
Returns:void
previousState()
Returns:null|
An object with these properties:
PropertyTypeDescription
cursorstring
pageSizenumber
|
An object with these properties:
PropertyTypeDescription
pagestring|number
pageSizestring|number
|
An object with these properties:
PropertyTypeDescription
limitnumber|string
offsetnumber|string
replaceStateControllers(props,props)
Params:
ParameterTypeDescription
*props[any, any]
*props[any, any]
Returns:void
setCurrentState(nextValue)
Params:
ParameterTypeDescription
*nextValue||
Returns:void
setInternalState(set)
Params:
ParameterTypeDescription
*set
Returns:void
setLimit(limit)
Params:
ParameterTypeDescription
*limitnull|number
Returns:void
setOffset(offset)
Params:
ParameterTypeDescription
*offsetnull|number
Returns:void
setPage(page)
Params:
ParameterTypeDescription
*pagenumber
Returns:void
setPageSize(pageSize)
Params:
ParameterTypeDescription
*pageSizenull|number
Returns:void
setResponse(response)
Params:
ParameterTypeDescription
*responseRecord
Returns:void

Properties

currentState

Source
An object with these properties:
PropertyTypeDescription
pagestring|number
pageSizestring|number
|
An object with these properties:
PropertyTypeDescription
cursorstring
pageSizenumber
|
An object with these properties:
PropertyTypeDescription
limitnumber|string
offsetnumber|string

cursor

Source
null|string

internalState

Source
Record

limit

Source
null|number

nextCursor

Source
null|string

offset

Source
null|number

page

Source
null|number

pageSize

Source
null|number

previousCursor

Source
null|string

responseIsSet

Source
boolean

total

Source
null|number

totalPages

Source
null|number

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