MCPcopy Create free account
hub / github.com/FlowiseAI/Flowise / getPageAndLimitParams

Function getPageAndLimitParams

packages/server/src/utils/pagination.ts:10–29  ·  view source on GitHub ↗
(req: Request)

Source from the content-addressed store, hash-verified

8}
9
10export const getPageAndLimitParams = (req: Request): Pagination => {
11 // by default assume no pagination
12 let page = -1
13 let limit = -1
14 if (req.query.page) {
15 // if page is provided, make sure it's a positive number
16 page = parseInt(req.query.page as string)
17 if (page < 0) {
18 throw new InternalFlowiseError(StatusCodes.PRECONDITION_FAILED, `Error: page cannot be negative!`)
19 }
20 }
21 if (req.query.limit) {
22 // if limit is provided, make sure it's a positive number
23 limit = parseInt(req.query.limit as string)
24 if (limit < 0) {
25 throw new InternalFlowiseError(StatusCodes.PRECONDITION_FAILED, `Error: limit cannot be negative!`)
26 }
27 }
28 return { page, limit }
29}

Callers 11

getAllToolsFunction · 0.90
getAllEvaluationsFunction · 0.90
getAllChatflowsFunction · 0.90
getAllVariablesFunction · 0.90
getAllDatasetsFunction · 0.90
getDatasetFunction · 0.90
getAllChatMessagesFunction · 0.90
getAllDocumentStoresFunction · 0.90
getAllApiKeysFunction · 0.90
getAllEvaluatorsFunction · 0.90
getAllCustomMcpServersFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected