@budibase/frontend-core 1.0.210 → 1.0.212-alpha.1
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/flags.js +9 -0
- package/src/api/other.js +9 -0
- package/src/api/rows.js +4 -1
- package/src/constants.js +22 -0
- package/src/utils/lucene.js +8 -10
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@budibase/frontend-core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.212-alpha.1",
|
|
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.
|
|
9
|
+
"@budibase/bbui": "^1.0.212-alpha.1",
|
|
10
10
|
"lodash": "^4.17.21",
|
|
11
11
|
"svelte": "^3.46.2"
|
|
12
12
|
},
|
|
13
|
-
"gitHead": "
|
|
13
|
+
"gitHead": "3bad427a96f80004a7d5fa8f08669cc1d41ff57a"
|
|
14
14
|
}
|
package/src/api/flags.js
CHANGED
|
@@ -22,4 +22,13 @@ export const buildFlagEndpoints = API => ({
|
|
|
22
22
|
},
|
|
23
23
|
})
|
|
24
24
|
},
|
|
25
|
+
/**
|
|
26
|
+
* Allows us to experimentally toggle a beta UI feature through a cookie.
|
|
27
|
+
* @param value the feature to toggle
|
|
28
|
+
*/
|
|
29
|
+
toggleUiFeature: async ({ value }) => {
|
|
30
|
+
return await API.post({
|
|
31
|
+
url: `/api/beta/${value}`,
|
|
32
|
+
})
|
|
33
|
+
},
|
|
25
34
|
})
|
package/src/api/other.js
CHANGED
|
@@ -54,4 +54,13 @@ export const buildOtherEndpoints = API => ({
|
|
|
54
54
|
url: "/api/permission/builtin",
|
|
55
55
|
})
|
|
56
56
|
},
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Check if they are part of the budibase beta program.
|
|
60
|
+
*/
|
|
61
|
+
checkBetaAccess: async email => {
|
|
62
|
+
return await API.get({
|
|
63
|
+
url: `${process.env.FEATURE_PREVIEW_URL}/api/beta/access?email=${email}`,
|
|
64
|
+
})
|
|
65
|
+
},
|
|
57
66
|
})
|
package/src/api/rows.js
CHANGED
|
@@ -65,12 +65,15 @@ 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)
|
|
68
70
|
*/
|
|
69
|
-
exportRows: async ({ tableId, rows, format }) => {
|
|
71
|
+
exportRows: async ({ tableId, rows, format, columns }) => {
|
|
70
72
|
return await API.post({
|
|
71
73
|
url: `/api/${tableId}/rows/exportRows?format=${format}`,
|
|
72
74
|
body: {
|
|
73
75
|
rows,
|
|
76
|
+
columns,
|
|
74
77
|
},
|
|
75
78
|
parseResponse: async response => {
|
|
76
79
|
return await response.text()
|
package/src/constants.js
CHANGED
|
@@ -63,3 +63,25 @@ export const TableNames = {
|
|
|
63
63
|
* - Coerce types for search endpoint
|
|
64
64
|
*/
|
|
65
65
|
export const ApiVersion = "1"
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Maximum minimum range for SQL number values
|
|
69
|
+
*/
|
|
70
|
+
export const SqlNumberTypeRangeMap = {
|
|
71
|
+
integer: {
|
|
72
|
+
max: 2147483647,
|
|
73
|
+
min: -2147483648,
|
|
74
|
+
},
|
|
75
|
+
int: {
|
|
76
|
+
max: 2147483647,
|
|
77
|
+
min: -2147483648,
|
|
78
|
+
},
|
|
79
|
+
smallint: {
|
|
80
|
+
max: 32767,
|
|
81
|
+
min: -32768,
|
|
82
|
+
},
|
|
83
|
+
mediumint: {
|
|
84
|
+
max: 8388607,
|
|
85
|
+
min: -8388608,
|
|
86
|
+
},
|
|
87
|
+
}
|
package/src/utils/lucene.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Helpers } from "@budibase/bbui"
|
|
2
|
-
import { OperatorOptions } from "../constants"
|
|
2
|
+
import { OperatorOptions, SqlNumberTypeRangeMap } from "../constants"
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Returns the valid operator options for a certain data type
|
|
@@ -94,7 +94,7 @@ export const buildLuceneQuery = filter => {
|
|
|
94
94
|
}
|
|
95
95
|
if (Array.isArray(filter)) {
|
|
96
96
|
filter.forEach(expression => {
|
|
97
|
-
let { operator, field, type, value } = expression
|
|
97
|
+
let { operator, field, type, value, externalType } = expression
|
|
98
98
|
// Parse all values into correct types
|
|
99
99
|
if (type === "datetime" && value) {
|
|
100
100
|
value = new Date(value).toISOString()
|
|
@@ -106,16 +106,14 @@ export const buildLuceneQuery = filter => {
|
|
|
106
106
|
value = `${value}`?.toLowerCase() === "true"
|
|
107
107
|
}
|
|
108
108
|
if (operator.startsWith("range")) {
|
|
109
|
+
const minint =
|
|
110
|
+
SqlNumberTypeRangeMap[externalType]?.min || Number.MIN_SAFE_INTEGER
|
|
111
|
+
const maxint =
|
|
112
|
+
SqlNumberTypeRangeMap[externalType]?.max || Number.MAX_SAFE_INTEGER
|
|
109
113
|
if (!query.range[field]) {
|
|
110
114
|
query.range[field] = {
|
|
111
|
-
low:
|
|
112
|
-
|
|
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",
|
|
115
|
+
low: type === "number" ? minint : "0000-00-00T00:00:00.000Z",
|
|
116
|
+
high: type === "number" ? maxint : "9999-00-00T00:00:00.000Z",
|
|
119
117
|
}
|
|
120
118
|
}
|
|
121
119
|
if (operator === "rangeLow" && value != null && value !== "") {
|