@budibase/frontend-core 2.11.31 → 2.11.33

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.
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@budibase/frontend-core",
3
- "version": "2.11.31",
3
+ "version": "2.11.33",
4
4
  "description": "Budibase frontend core libraries used in builder and client",
5
5
  "author": "Budibase",
6
6
  "license": "MPL-2.0",
7
7
  "svelte": "src/index.js",
8
8
  "dependencies": {
9
- "@budibase/bbui": "2.11.31",
10
- "@budibase/shared-core": "2.11.31",
9
+ "@budibase/bbui": "2.11.33",
10
+ "@budibase/shared-core": "2.11.33",
11
11
  "dayjs": "^1.10.8",
12
12
  "lodash": "^4.17.21",
13
13
  "socket.io-client": "^4.6.1",
14
14
  "svelte": "^3.46.2"
15
15
  },
16
- "gitHead": "63f2a0d0f13b058566d26aa803eb21fcbb1b239c"
16
+ "gitHead": "68771f42f956392fcd330c10fc4ffc13d83aa5e9"
17
17
  }
package/src/api/user.js CHANGED
@@ -10,24 +10,28 @@ export const buildUserEndpoints = API => ({
10
10
 
11
11
  /**
12
12
  * Gets a list of users in the current tenant.
13
- * @param {string} page The page to retrieve
14
- * @param {string} search The starts with string to search username/email by.
13
+ * @param {string} bookmark The page to retrieve
14
+ * @param {object} query search filters for lookup by user (all operators not supported).
15
15
  * @param {string} appId Facilitate app/role based user searching
16
- * @param {boolean} paginated Allow the disabling of pagination
16
+ * @param {boolean} paginate Allow the disabling of pagination
17
+ * @param {number} limit How many users to retrieve in a single search
17
18
  */
18
- searchUsers: async ({ paginated, page, email, appId } = {}) => {
19
+ searchUsers: async ({ paginate, bookmark, query, appId, limit } = {}) => {
19
20
  const opts = {}
20
- if (page) {
21
- opts.page = page
21
+ if (bookmark) {
22
+ opts.bookmark = bookmark
22
23
  }
23
- if (email) {
24
- opts.email = email
24
+ if (query) {
25
+ opts.query = query
25
26
  }
26
27
  if (appId) {
27
28
  opts.appId = appId
28
29
  }
29
- if (typeof paginated === "boolean") {
30
- opts.paginated = paginated
30
+ if (typeof paginate === "boolean") {
31
+ opts.paginate = paginate
32
+ }
33
+ if (limit) {
34
+ opts.limit = limit
31
35
  }
32
36
  return await API.post({
33
37
  url: `/api/global/users/search`,
@@ -27,7 +27,7 @@
27
27
  const email = Object.values(searchParams.query.string)[0]
28
28
 
29
29
  const results = await API.searchUsers({
30
- email,
30
+ query: { string: { email } },
31
31
  })
32
32
 
33
33
  // Mapping to the expected data within RelationshipCell
@@ -1,6 +1,7 @@
1
1
  import { get } from "svelte/store"
2
2
  import DataFetch from "./DataFetch.js"
3
3
  import { TableNames } from "../constants"
4
+ import { LuceneUtils } from "../utils"
4
5
 
5
6
  export default class UserFetch extends DataFetch {
6
7
  constructor(opts) {
@@ -27,16 +28,25 @@ export default class UserFetch extends DataFetch {
27
28
  }
28
29
 
29
30
  async getData() {
31
+ const { limit, paginate } = this.options
30
32
  const { cursor, query } = get(this.store)
33
+ let finalQuery
34
+ // convert old format to new one - we now allow use of the lucene format
35
+ const { appId, paginated, ...rest } = query
36
+ if (!LuceneUtils.hasFilters(query) && rest.email) {
37
+ finalQuery = { string: { email: rest.email } }
38
+ } else {
39
+ finalQuery = rest
40
+ }
31
41
  try {
32
- // "query" normally contains a lucene query, but users uses a non-standard
33
- // search endpoint so we use query uniquely here
34
- const res = await this.API.searchUsers({
35
- page: cursor,
36
- email: query.email,
37
- appId: query.appId,
38
- paginated: query.paginated,
39
- })
42
+ const opts = {
43
+ bookmark: cursor,
44
+ query: finalQuery,
45
+ appId: appId,
46
+ paginate: paginated || paginate,
47
+ limit,
48
+ }
49
+ const res = await this.API.searchUsers(opts)
40
50
  return {
41
51
  rows: res?.data || [],
42
52
  hasNextPage: res?.hasNextPage || false,