@budibase/backend-core 2.11.39 → 2.11.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -19,6 +19,7 @@ import {
19
19
  SearchUsersRequest,
20
20
  User,
21
21
  ContextUser,
22
+ DatabaseQueryOpts,
22
23
  } from "@budibase/types"
23
24
  import { getGlobalDB } from "../context"
24
25
  import * as context from "../context"
@@ -241,12 +242,14 @@ export const paginatedUsers = async ({
241
242
  bookmark,
242
243
  query,
243
244
  appId,
245
+ limit,
244
246
  }: SearchUsersRequest = {}) => {
245
247
  const db = getGlobalDB()
248
+ const pageLimit = limit ? limit + 1 : PAGE_LIMIT + 1
246
249
  // get one extra document, to have the next page
247
- const opts: any = {
250
+ const opts: DatabaseQueryOpts = {
248
251
  include_docs: true,
249
- limit: PAGE_LIMIT + 1,
252
+ limit: pageLimit,
250
253
  }
251
254
  // add a startkey if the page was specified (anchor)
252
255
  if (bookmark) {
@@ -269,7 +272,7 @@ export const paginatedUsers = async ({
269
272
  const response = await db.allDocs(getGlobalUserParams(null, opts))
270
273
  userList = response.rows.map((row: any) => row.doc)
271
274
  }
272
- return pagination(userList, PAGE_LIMIT, {
275
+ return pagination(userList, pageLimit, {
273
276
  paginate: true,
274
277
  property,
275
278
  getKey,