@budibase/frontend-core 1.0.219-alpha.7 → 1.0.219
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/automations.js +0 -35
- package/src/api/other.js +0 -1
- package/src/api/rows.js +1 -4
- package/src/api/user.js +0 -28
- package/src/constants.js +0 -26
- package/src/utils/lucene.js +14 -30
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@budibase/frontend-core",
|
|
3
|
-
"version": "1.0.219
|
|
3
|
+
"version": "1.0.219",
|
|
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.0.219
|
|
9
|
+
"@budibase/bbui": "^1.0.219",
|
|
10
10
|
"lodash": "^4.17.21",
|
|
11
11
|
"svelte": "^3.46.2"
|
|
12
12
|
},
|
|
13
|
-
"gitHead": "
|
|
13
|
+
"gitHead": "231b038a3c99f730dd27a595f870663dd84b7837"
|
|
14
14
|
}
|
package/src/api/automations.js
CHANGED
|
@@ -73,39 +73,4 @@ export const buildAutomationEndpoints = API => ({
|
|
|
73
73
|
url: `/api/automations/${automationId}/${automationRev}`,
|
|
74
74
|
})
|
|
75
75
|
},
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Get the logs for the app, or by automation ID.
|
|
79
|
-
* @param automationId The ID of the automation to get logs for.
|
|
80
|
-
* @param startDate An ISO date string to state the start of the date range.
|
|
81
|
-
* @param status The status, error or success.
|
|
82
|
-
* @param page The page to retrieve.
|
|
83
|
-
*/
|
|
84
|
-
getAutomationLogs: async ({ automationId, startDate, status, page }) => {
|
|
85
|
-
return await API.post({
|
|
86
|
-
url: "/api/automations/logs/search",
|
|
87
|
-
body: {
|
|
88
|
-
automationId,
|
|
89
|
-
startDate,
|
|
90
|
-
status,
|
|
91
|
-
page,
|
|
92
|
-
},
|
|
93
|
-
})
|
|
94
|
-
},
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Clears automation log errors (which are creating notification) for
|
|
98
|
-
* automation or the app.
|
|
99
|
-
* @param automationId optional - the ID of the automation to clear errors for.
|
|
100
|
-
* @param appId The app ID to clear errors for.
|
|
101
|
-
*/
|
|
102
|
-
clearAutomationLogErrors: async ({ automationId, appId }) => {
|
|
103
|
-
return await API.delete({
|
|
104
|
-
url: "/api/automations/logs",
|
|
105
|
-
body: {
|
|
106
|
-
appId,
|
|
107
|
-
automationId,
|
|
108
|
-
},
|
|
109
|
-
})
|
|
110
|
-
},
|
|
111
76
|
})
|
package/src/api/other.js
CHANGED
package/src/api/rows.js
CHANGED
|
@@ -65,15 +65,12 @@ export const buildRowEndpoints = API => ({
|
|
|
65
65
|
* Exports rows.
|
|
66
66
|
* @param tableId the table ID to export the rows from
|
|
67
67
|
* @param rows the array of rows to export
|
|
68
|
-
* @param format the format to export (csv or json)
|
|
69
|
-
* @param columns which columns to export (all if undefined)
|
|
70
68
|
*/
|
|
71
|
-
exportRows: async ({ tableId, rows, format
|
|
69
|
+
exportRows: async ({ tableId, rows, format }) => {
|
|
72
70
|
return await API.post({
|
|
73
71
|
url: `/api/${tableId}/rows/exportRows?format=${format}`,
|
|
74
72
|
body: {
|
|
75
73
|
rows,
|
|
76
|
-
columns,
|
|
77
74
|
},
|
|
78
75
|
parseResponse: async response => {
|
|
79
76
|
return await response.text()
|
package/src/api/user.js
CHANGED
|
@@ -8,34 +8,6 @@ export const buildUserEndpoints = API => ({
|
|
|
8
8
|
})
|
|
9
9
|
},
|
|
10
10
|
|
|
11
|
-
/**
|
|
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.
|
|
15
|
-
*/
|
|
16
|
-
searchUsers: async ({ page, search } = {}) => {
|
|
17
|
-
const opts = {}
|
|
18
|
-
if (page) {
|
|
19
|
-
opts.page = page
|
|
20
|
-
}
|
|
21
|
-
if (search) {
|
|
22
|
-
opts.search = search
|
|
23
|
-
}
|
|
24
|
-
return await API.post({
|
|
25
|
-
url: `/api/global/users/search`,
|
|
26
|
-
body: opts,
|
|
27
|
-
})
|
|
28
|
-
},
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Get a single user by ID.
|
|
32
|
-
*/
|
|
33
|
-
getUser: async userId => {
|
|
34
|
-
return await API.get({
|
|
35
|
-
url: `/api/global/users/${userId}`,
|
|
36
|
-
})
|
|
37
|
-
},
|
|
38
|
-
|
|
39
11
|
/**
|
|
40
12
|
* Creates a user for an app.
|
|
41
13
|
* @param user the user to create
|
package/src/constants.js
CHANGED
|
@@ -42,10 +42,6 @@ export const OperatorOptions = {
|
|
|
42
42
|
value: "notEqual",
|
|
43
43
|
label: "Does Not Contain",
|
|
44
44
|
},
|
|
45
|
-
In: {
|
|
46
|
-
value: "oneOf",
|
|
47
|
-
label: "Is in",
|
|
48
|
-
},
|
|
49
45
|
}
|
|
50
46
|
|
|
51
47
|
// Cookie names
|
|
@@ -67,25 +63,3 @@ export const TableNames = {
|
|
|
67
63
|
* - Coerce types for search endpoint
|
|
68
64
|
*/
|
|
69
65
|
export const ApiVersion = "1"
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Maximum minimum range for SQL number values
|
|
73
|
-
*/
|
|
74
|
-
export const SqlNumberTypeRangeMap = {
|
|
75
|
-
integer: {
|
|
76
|
-
max: 2147483647,
|
|
77
|
-
min: -2147483648,
|
|
78
|
-
},
|
|
79
|
-
int: {
|
|
80
|
-
max: 2147483647,
|
|
81
|
-
min: -2147483648,
|
|
82
|
-
},
|
|
83
|
-
smallint: {
|
|
84
|
-
max: 32767,
|
|
85
|
-
min: -32768,
|
|
86
|
-
},
|
|
87
|
-
mediumint: {
|
|
88
|
-
max: 8388607,
|
|
89
|
-
min: -8388608,
|
|
90
|
-
},
|
|
91
|
-
}
|
package/src/utils/lucene.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Helpers } from "@budibase/bbui"
|
|
2
|
-
import { OperatorOptions
|
|
2
|
+
import { OperatorOptions } from "../constants"
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Returns the valid operator options for a certain data type
|
|
@@ -14,7 +14,6 @@ export const getValidOperatorsForType = type => {
|
|
|
14
14
|
Op.Like,
|
|
15
15
|
Op.Empty,
|
|
16
16
|
Op.NotEmpty,
|
|
17
|
-
Op.In,
|
|
18
17
|
]
|
|
19
18
|
const numOps = [
|
|
20
19
|
Op.Equals,
|
|
@@ -23,7 +22,6 @@ export const getValidOperatorsForType = type => {
|
|
|
23
22
|
Op.LessThan,
|
|
24
23
|
Op.Empty,
|
|
25
24
|
Op.NotEmpty,
|
|
26
|
-
Op.In,
|
|
27
25
|
]
|
|
28
26
|
if (type === "string") {
|
|
29
27
|
return stringOps
|
|
@@ -93,34 +91,31 @@ export const buildLuceneQuery = filter => {
|
|
|
93
91
|
notEmpty: {},
|
|
94
92
|
contains: {},
|
|
95
93
|
notContains: {},
|
|
96
|
-
oneOf: {},
|
|
97
94
|
}
|
|
98
95
|
if (Array.isArray(filter)) {
|
|
99
96
|
filter.forEach(expression => {
|
|
100
|
-
let { operator, field, type, value
|
|
97
|
+
let { operator, field, type, value } = expression
|
|
101
98
|
// Parse all values into correct types
|
|
102
99
|
if (type === "datetime" && value) {
|
|
103
100
|
value = new Date(value).toISOString()
|
|
104
101
|
}
|
|
105
|
-
if (type === "number"
|
|
106
|
-
|
|
107
|
-
value = value.split(",").map(item => parseFloat(item))
|
|
108
|
-
} else {
|
|
109
|
-
value = parseFloat(value)
|
|
110
|
-
}
|
|
102
|
+
if (type === "number") {
|
|
103
|
+
value = parseFloat(value)
|
|
111
104
|
}
|
|
112
105
|
if (type === "boolean") {
|
|
113
106
|
value = `${value}`?.toLowerCase() === "true"
|
|
114
107
|
}
|
|
115
108
|
if (operator.startsWith("range")) {
|
|
116
|
-
const minint =
|
|
117
|
-
SqlNumberTypeRangeMap[externalType]?.min || Number.MIN_SAFE_INTEGER
|
|
118
|
-
const maxint =
|
|
119
|
-
SqlNumberTypeRangeMap[externalType]?.max || Number.MAX_SAFE_INTEGER
|
|
120
109
|
if (!query.range[field]) {
|
|
121
110
|
query.range[field] = {
|
|
122
|
-
low:
|
|
123
|
-
|
|
111
|
+
low:
|
|
112
|
+
type === "number"
|
|
113
|
+
? Number.MIN_SAFE_INTEGER
|
|
114
|
+
: "0000-00-00T00:00:00.000Z",
|
|
115
|
+
high:
|
|
116
|
+
type === "number"
|
|
117
|
+
? Number.MAX_SAFE_INTEGER
|
|
118
|
+
: "9999-00-00T00:00:00.000Z",
|
|
124
119
|
}
|
|
125
120
|
}
|
|
126
121
|
if (operator === "rangeLow" && value != null && value !== "") {
|
|
@@ -146,6 +141,7 @@ export const buildLuceneQuery = filter => {
|
|
|
146
141
|
}
|
|
147
142
|
})
|
|
148
143
|
}
|
|
144
|
+
|
|
149
145
|
return query
|
|
150
146
|
}
|
|
151
147
|
|
|
@@ -217,17 +213,6 @@ export const runLuceneQuery = (docs, query) => {
|
|
|
217
213
|
return docValue == null || docValue === ""
|
|
218
214
|
})
|
|
219
215
|
|
|
220
|
-
// Process an includes match (fails if the value is not included)
|
|
221
|
-
const oneOf = match("oneOf", (docValue, testValue) => {
|
|
222
|
-
if (typeof testValue === "string") {
|
|
223
|
-
testValue = testValue.split(",")
|
|
224
|
-
if (typeof docValue === "number") {
|
|
225
|
-
testValue = testValue.map(item => parseFloat(item))
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
return !testValue?.includes(docValue)
|
|
229
|
-
})
|
|
230
|
-
|
|
231
216
|
// Match a document against all criteria
|
|
232
217
|
const docMatch = doc => {
|
|
233
218
|
return (
|
|
@@ -237,8 +222,7 @@ export const runLuceneQuery = (docs, query) => {
|
|
|
237
222
|
equalMatch(doc) &&
|
|
238
223
|
notEqualMatch(doc) &&
|
|
239
224
|
emptyMatch(doc) &&
|
|
240
|
-
notEmptyMatch(doc)
|
|
241
|
-
oneOf(doc)
|
|
225
|
+
notEmptyMatch(doc)
|
|
242
226
|
)
|
|
243
227
|
}
|
|
244
228
|
|