@budibase/frontend-core 1.1.29-alpha.2 → 1.1.31
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 +3 -3
- package/src/api/index.js +0 -2
- package/src/api/user.js +3 -52
- package/src/constants.js +2 -36
- package/src/utils/lucene.js +7 -11
- package/src/api/groups.js +0 -40
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@budibase/frontend-core",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.31",
|
|
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": "^1.1.
|
|
9
|
+
"@budibase/bbui": "^1.1.31",
|
|
10
10
|
"lodash": "^4.17.21",
|
|
11
11
|
"svelte": "^3.46.2"
|
|
12
12
|
},
|
|
13
|
-
"gitHead": "
|
|
13
|
+
"gitHead": "da3be5a095ce403e4f1ff13e3b9f21708a998e6b"
|
|
14
14
|
}
|
package/src/api/index.js
CHANGED
|
@@ -23,7 +23,6 @@ import { buildUserEndpoints } from "./user"
|
|
|
23
23
|
import { buildSelfEndpoints } from "./self"
|
|
24
24
|
import { buildViewEndpoints } from "./views"
|
|
25
25
|
import { buildLicensingEndpoints } from "./licensing"
|
|
26
|
-
import { buildGroupsEndpoints } from "./groups"
|
|
27
26
|
|
|
28
27
|
const defaultAPIClientConfig = {
|
|
29
28
|
/**
|
|
@@ -242,6 +241,5 @@ export const createAPIClient = config => {
|
|
|
242
241
|
...buildViewEndpoints(API),
|
|
243
242
|
...buildSelfEndpoints(API),
|
|
244
243
|
...buildLicensingEndpoints(API),
|
|
245
|
-
...buildGroupsEndpoints(API),
|
|
246
244
|
}
|
|
247
245
|
}
|
package/src/api/user.js
CHANGED
|
@@ -13,16 +13,13 @@ export const buildUserEndpoints = API => ({
|
|
|
13
13
|
* @param {string} page The page to retrieve
|
|
14
14
|
* @param {string} search The starts with string to search username/email by.
|
|
15
15
|
*/
|
|
16
|
-
searchUsers: async ({ page,
|
|
16
|
+
searchUsers: async ({ page, search } = {}) => {
|
|
17
17
|
const opts = {}
|
|
18
18
|
if (page) {
|
|
19
19
|
opts.page = page
|
|
20
20
|
}
|
|
21
|
-
if (
|
|
22
|
-
opts.
|
|
23
|
-
}
|
|
24
|
-
if (appId) {
|
|
25
|
-
opts.appId = appId
|
|
21
|
+
if (search) {
|
|
22
|
+
opts.search = search
|
|
26
23
|
}
|
|
27
24
|
return await API.post({
|
|
28
25
|
url: `/api/global/users/search`,
|
|
@@ -83,20 +80,6 @@ export const buildUserEndpoints = API => ({
|
|
|
83
80
|
})
|
|
84
81
|
},
|
|
85
82
|
|
|
86
|
-
/**
|
|
87
|
-
* Creates multiple users.
|
|
88
|
-
* @param users the array of user objects to create
|
|
89
|
-
*/
|
|
90
|
-
createUsers: async ({ users, groups }) => {
|
|
91
|
-
return await API.post({
|
|
92
|
-
url: "/api/global/users/bulkCreate",
|
|
93
|
-
body: {
|
|
94
|
-
users,
|
|
95
|
-
groups,
|
|
96
|
-
},
|
|
97
|
-
})
|
|
98
|
-
},
|
|
99
|
-
|
|
100
83
|
/**
|
|
101
84
|
* Deletes a user from the curernt tenant.
|
|
102
85
|
* @param userId the ID of the user to delete
|
|
@@ -107,19 +90,6 @@ export const buildUserEndpoints = API => ({
|
|
|
107
90
|
})
|
|
108
91
|
},
|
|
109
92
|
|
|
110
|
-
/**
|
|
111
|
-
* Deletes multiple users
|
|
112
|
-
* @param userId the ID of the user to delete
|
|
113
|
-
*/
|
|
114
|
-
deleteUsers: async userIds => {
|
|
115
|
-
return await API.post({
|
|
116
|
-
url: `/api/global/users/bulkDelete`,
|
|
117
|
-
body: {
|
|
118
|
-
userIds,
|
|
119
|
-
},
|
|
120
|
-
})
|
|
121
|
-
},
|
|
122
|
-
|
|
123
93
|
/**
|
|
124
94
|
* Invites a user to the current tenant.
|
|
125
95
|
* @param email the email address to send the invitation to
|
|
@@ -139,25 +109,6 @@ export const buildUserEndpoints = API => ({
|
|
|
139
109
|
})
|
|
140
110
|
},
|
|
141
111
|
|
|
142
|
-
/**
|
|
143
|
-
* Invites multiple users to the current tenant.
|
|
144
|
-
* @param email An array of email addresses
|
|
145
|
-
* @param builder whether the user should be a global builder
|
|
146
|
-
* @param admin whether the user should be a global admin
|
|
147
|
-
*/
|
|
148
|
-
inviteUsers: async ({ emails, builder, admin }) => {
|
|
149
|
-
return await API.post({
|
|
150
|
-
url: "/api/global/users/inviteMultiple",
|
|
151
|
-
body: {
|
|
152
|
-
emails,
|
|
153
|
-
userInfo: {
|
|
154
|
-
admin: admin ? { global: true } : undefined,
|
|
155
|
-
builder: builder ? { global: true } : undefined,
|
|
156
|
-
},
|
|
157
|
-
},
|
|
158
|
-
})
|
|
159
|
-
},
|
|
160
|
-
|
|
161
112
|
/**
|
|
162
113
|
* Accepts an invite to join the platform and creates a user.
|
|
163
114
|
* @param inviteCode the invite code sent in the email
|
package/src/constants.js
CHANGED
|
@@ -35,7 +35,7 @@ export const OperatorOptions = {
|
|
|
35
35
|
label: "Less than",
|
|
36
36
|
},
|
|
37
37
|
Contains: {
|
|
38
|
-
value: "
|
|
38
|
+
value: "equal",
|
|
39
39
|
label: "Contains",
|
|
40
40
|
},
|
|
41
41
|
NotContains: {
|
|
@@ -60,37 +60,6 @@ export const TableNames = {
|
|
|
60
60
|
USERS: "ta_users",
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
export const BbRoles = [
|
|
64
|
-
{ label: "App User", value: "appUser" },
|
|
65
|
-
{ label: "Developer", value: "developer" },
|
|
66
|
-
{ label: "Admin", value: "admin" },
|
|
67
|
-
]
|
|
68
|
-
|
|
69
|
-
export const BuilderRoleDescriptions = [
|
|
70
|
-
{
|
|
71
|
-
value: "appUser",
|
|
72
|
-
icon: "User",
|
|
73
|
-
label: "App user - Only has access to published apps",
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
value: "developer",
|
|
77
|
-
icon: "Hammer",
|
|
78
|
-
label: "Developer - Access to the app builder",
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
value: "admin",
|
|
82
|
-
icon: "Draw",
|
|
83
|
-
label: "Admin - Full access",
|
|
84
|
-
},
|
|
85
|
-
]
|
|
86
|
-
|
|
87
|
-
export const PlanType = {
|
|
88
|
-
FREE: "free",
|
|
89
|
-
TEAM: "team",
|
|
90
|
-
BUSINESS: "business",
|
|
91
|
-
ENTERPRISE: "enterprise",
|
|
92
|
-
}
|
|
93
|
-
|
|
94
63
|
/**
|
|
95
64
|
* API version header attached to all requests.
|
|
96
65
|
* Version changelog:
|
|
@@ -99,10 +68,6 @@ export const PlanType = {
|
|
|
99
68
|
*/
|
|
100
69
|
export const ApiVersion = "1"
|
|
101
70
|
|
|
102
|
-
export const Features = {
|
|
103
|
-
USER_GROUPS: "userGroups",
|
|
104
|
-
}
|
|
105
|
-
|
|
106
71
|
// Role IDs
|
|
107
72
|
export const Roles = {
|
|
108
73
|
ADMIN: "ADMIN",
|
|
@@ -111,6 +76,7 @@ export const Roles = {
|
|
|
111
76
|
PUBLIC: "PUBLIC",
|
|
112
77
|
BUILDER: "BUILDER",
|
|
113
78
|
}
|
|
79
|
+
|
|
114
80
|
/**
|
|
115
81
|
* Maximum minimum range for SQL number values
|
|
116
82
|
*/
|
package/src/utils/lucene.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Helpers } from "@budibase/bbui"
|
|
2
2
|
import { OperatorOptions, SqlNumberTypeRangeMap } from "../constants"
|
|
3
3
|
|
|
4
|
+
const HBS_REGEX = /{{([^{].*?)}}/g
|
|
5
|
+
|
|
4
6
|
/**
|
|
5
7
|
* Returns the valid operator options for a certain data type
|
|
6
8
|
* @param type the data type
|
|
@@ -98,22 +100,16 @@ export const buildLuceneQuery = filter => {
|
|
|
98
100
|
if (Array.isArray(filter)) {
|
|
99
101
|
filter.forEach(expression => {
|
|
100
102
|
let { operator, field, type, value, externalType } = expression
|
|
103
|
+
const isHbs =
|
|
104
|
+
typeof value === "string" && value.match(HBS_REGEX)?.length > 0
|
|
101
105
|
// Parse all values into correct types
|
|
102
|
-
if (type === "datetime") {
|
|
103
|
-
|
|
104
|
-
if (!value) {
|
|
105
|
-
return
|
|
106
|
-
}
|
|
107
|
-
try {
|
|
108
|
-
value = new Date(value).toISOString()
|
|
109
|
-
} catch (error) {
|
|
110
|
-
return
|
|
111
|
-
}
|
|
106
|
+
if (type === "datetime" && value) {
|
|
107
|
+
value = new Date(value).toISOString()
|
|
112
108
|
}
|
|
113
109
|
if (type === "number" && !Array.isArray(value)) {
|
|
114
110
|
if (operator === "oneOf") {
|
|
115
111
|
value = value.split(",").map(item => parseFloat(item))
|
|
116
|
-
} else {
|
|
112
|
+
} else if (!isHbs) {
|
|
117
113
|
value = parseFloat(value)
|
|
118
114
|
}
|
|
119
115
|
}
|
package/src/api/groups.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
export const buildGroupsEndpoints = API => ({
|
|
2
|
-
/**
|
|
3
|
-
* Creates a user group.
|
|
4
|
-
* @param user the new group to create
|
|
5
|
-
*/
|
|
6
|
-
saveGroup: async group => {
|
|
7
|
-
return await API.post({
|
|
8
|
-
url: "/api/global/groups",
|
|
9
|
-
body: group,
|
|
10
|
-
})
|
|
11
|
-
},
|
|
12
|
-
/**
|
|
13
|
-
* Gets all of the user groups
|
|
14
|
-
*/
|
|
15
|
-
getGroups: async () => {
|
|
16
|
-
return await API.get({
|
|
17
|
-
url: "/api/global/groups",
|
|
18
|
-
})
|
|
19
|
-
},
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Gets a group by ID
|
|
23
|
-
*/
|
|
24
|
-
getGroup: async id => {
|
|
25
|
-
return await API.get({
|
|
26
|
-
url: `/api/global/groups/${id}`,
|
|
27
|
-
})
|
|
28
|
-
},
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Deletes a user group
|
|
32
|
-
* @param id the id of the config to delete
|
|
33
|
-
* @param rev the revision of the config to delete
|
|
34
|
-
*/
|
|
35
|
-
deleteGroup: async ({ id, rev }) => {
|
|
36
|
-
return await API.delete({
|
|
37
|
-
url: `/api/global/groups/${id}/${rev}`,
|
|
38
|
-
})
|
|
39
|
-
},
|
|
40
|
-
})
|