InferredPaginator

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

API

Constructor

new InferredPaginator(currentStatePair,internalStatePair)

Arguments:

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

Arguments:

ArgumentTypeDescription
*currentInitany
Returns:
An object with these properties:
PropertyTypeDescription
headersHeadersInit|Record
queryRecord
urlArgsRecord
...any
Any properties from RequestInit except for these:
  • headers
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)

Arguments:

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

Arguments:

ArgumentTypeDescription
*offsetnull|number
Returns:null|
An object with these properties:
PropertyTypeDescription
limitnumber|string
offsetnumber|string
pageSizeState(pageSize)

Arguments:

ArgumentTypeDescription
*pageSizenull|number
Returns:null|
An object with these properties:
PropertyTypeDescription
cursorstring
pageSizenumber
|
An object with these properties:
PropertyTypeDescription
pagestring|number
pageSizestring|number
pageState(page)

Arguments:

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

Arguments:

ArgumentTypeDescription
*props[any, any]
*props[any, any]
Returns:void
setCurrentState(nextValue)

Component Props:

PropTypeDescription
*nextValue||
setInternalState(set)

Component Props:

PropTypeDescription
*set
setLimit(limit)

Arguments:

ArgumentTypeDescription
*limitnull|number
Returns:void
setOffset(offset)

Arguments:

ArgumentTypeDescription
*offsetnull|number
Returns:void
setPage(page)

Arguments:

ArgumentTypeDescription
*pagenumber
Returns:void
setPageSize(pageSize)

Arguments:

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

Arguments:

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

Arguments:

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